Skip to content

Commit 4365c73

Browse files
committed
Refactor isOkVarChar function for simplicity and efficiency
1 parent f89449a commit 4365c73

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

Diff for: jQuery-hook.js

+1-10
Original file line numberDiff line numberDiff line change
@@ -312,16 +312,7 @@
312312
* @returns {boolean}
313313
*/
314314
function isOkVarChar(c) {
315-
if (c >= 'a' && c <= 'z') {
316-
return true;
317-
}
318-
if (c >= 'A' && c <= 'Z') {
319-
return true;
320-
}
321-
if (c >= '0' && c <= '9') {
322-
return true;
323-
}
324-
return false;
315+
return (/^[a-zA-Z0-9]$/).test(c);
325316
}
326317

327318
// ----------------------------------------------- -----------------------------------------------------------------

0 commit comments

Comments
 (0)