diff options
author | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-03-21 08:38:41 +0100 |
---|---|---|
committer | Benoit Giannangeli <benoit.giannangeli@boursorama.fr> | 2017-03-21 09:03:37 +0100 |
commit | 66292a6a85cf22cae31520ea4d08c76f544e338a (patch) | |
tree | 3a0c53434a4008359d8d7c9f4bffc93f32b7a9c4 /src/ljstype.js | |
parent | 2cc93b924a21030fcd6f5dc96f287bbf13f987f4 (diff) | |
download | fengari-66292a6a85cf22cae31520ea4d08c76f544e338a.tar.gz fengari-66292a6a85cf22cae31520ea4d08c76f544e338a.tar.bz2 fengari-66292a6a85cf22cae31520ea4d08c76f544e338a.zip |
string.gsub tests
Diffstat (limited to 'src/ljstype.js')
-rw-r--r-- | src/ljstype.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ljstype.js b/src/ljstype.js index ef4be1d..7de9d9a 100644 --- a/src/ljstype.js +++ b/src/ljstype.js @@ -3,23 +3,23 @@ const assert = require('assert'); const lisdigit = function(c) { - return /^\d$/.test(c.charAt(0)); + return typeof c === 'string' && /^\d$/.test(c.charAt(0)); }; const lisxdigit = function(c) { - return /^[0-9a-fA-F]$/.test(c.charAt(0)); + return typeof c === 'string' && /^[0-9a-fA-F]$/.test(c.charAt(0)); }; const lisspace = function(c) { - return /^\s$/.test(c.charAt(0)); + return typeof c === 'string' && /^\s$/.test(c.charAt(0)); }; const lislalpha = function(c) { - return /^[_a-zA-Z]$/.test(c.charAt(0)); + return typeof c === 'string' && /^[_a-zA-Z]$/.test(c.charAt(0)); }; const lislalnum = function(c) { - return /^[_a-zA-Z0-9]$/.test(c.charAt(0)); + return typeof c === 'string' && /^[_a-zA-Z0-9]$/.test(c.charAt(0)); }; module.exports.lisdigit = lisdigit; |