mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
alphanumeric.js: improve namiug a bit
This commit is contained in:
@@ -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_-'));
|
||||||
|
|||||||
Reference in New Issue
Block a user