alphanumeric.js: improve namiug a bit

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-10-16 00:00:00 +00:00
parent 5b7094fb68
commit e70e433702

View File

@@ -30,14 +30,14 @@ const is_almost_alphanumeric = function (str) {
for (let c of str) { for (let c of str) {
if ( if (
!char_is_alphanumeric(c) && !char_is_alphanumeric(c) &&
!is_almost_alphanumeric.almost_chars.has(c) !is_almost_alphanumeric.chars.has(c)
) { ) {
return false; return false;
} }
} }
return true; return true;
}; };
is_almost_alphanumeric.almost_chars = new Set(['-', '_']); is_almost_alphanumeric.chars = new Set(['-', '_']);
assert( is_alphanumeric('aB0')); assert( is_alphanumeric('aB0'));
assert(!is_alphanumeric('aB0_-')); assert(!is_alphanumeric('aB0_-'));