summaryrefslogtreecommitdiff
path: root/src/ljstype.js
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-03-29 11:57:43 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-03-29 14:37:07 +0200
commit2e5b595a2e04fe72555a565af4aae43560946473 (patch)
tree750e770114181283acb0fd78f7ad241c17c3d9a7 /src/ljstype.js
parent36f3247d47c1ad854fa89aabf17f6d954a6a6657 (diff)
downloadfengari-2e5b595a2e04fe72555a565af4aae43560946473.tar.gz
fengari-2e5b595a2e04fe72555a565af4aae43560946473.tar.bz2
fengari-2e5b595a2e04fe72555a565af4aae43560946473.zip
Never use js strings internally
Diffstat (limited to 'src/ljstype.js')
-rw-r--r--src/ljstype.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ljstype.js b/src/ljstype.js
index 7de9d9a..6f371bb 100644
--- a/src/ljstype.js
+++ b/src/ljstype.js
@@ -3,27 +3,27 @@
const assert = require('assert');
const lisdigit = function(c) {
- return typeof c === 'string' && /^\d$/.test(c.charAt(0));
+ return /^\d$/.test(String.fromCharCode(c));
};
const lisxdigit = function(c) {
- return typeof c === 'string' && /^[0-9a-fA-F]$/.test(c.charAt(0));
+ return /^[0-9a-fA-F]$/.test(String.fromCharCode(c));
};
const lisspace = function(c) {
- return typeof c === 'string' && /^\s$/.test(c.charAt(0));
+ return /^\s$/.test(String.fromCharCode(c));
};
const lislalpha = function(c) {
- return typeof c === 'string' && /^[_a-zA-Z]$/.test(c.charAt(0));
+ return /^[_a-zA-Z]$/.test(String.fromCharCode(c));
};
const lislalnum = function(c) {
- return typeof c === 'string' && /^[_a-zA-Z0-9]$/.test(c.charAt(0));
+ return /^[_a-zA-Z0-9]$/.test(String.fromCharCode(c));
};
module.exports.lisdigit = lisdigit;
module.exports.lislalnum = lislalnum;
module.exports.lislalpha = lislalpha;
module.exports.lisspace = lisspace;
-module.exports.lisxdigit = lisxdigit; \ No newline at end of file
+module.exports.lisxdigit = lisxdigit;