esutils
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -29,3 +29,3 @@ /* | ||
var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES; | ||
var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; | ||
@@ -48,13 +48,13 @@ // See `tools/generate-identifier-regex.js`. | ||
function isDecimalDigit(ch) { | ||
return (ch >= 48 && ch <= 57); // 0..9 | ||
return 0x30 <= ch && ch <= 0x39; // 0..9 | ||
} | ||
function isHexDigit(ch) { | ||
return isDecimalDigit(ch) || // 0..9 | ||
(97 <= ch && ch <= 102) || // a..f | ||
(65 <= ch && ch <= 70); // A..F | ||
return 0x30 <= ch && ch <= 0x39 || // 0..9 | ||
0x61 <= ch && ch <= 0x66 || // a..f | ||
0x41 <= ch && ch <= 0x46; // A..F | ||
} | ||
function isOctalDigit(ch) { | ||
return (ch >= 48 && ch <= 55); // 0..7 | ||
return ch >= 0x30 && ch <= 0x37; // 0..7 | ||
} | ||
@@ -73,4 +73,4 @@ | ||
function isWhiteSpace(ch) { | ||
return (ch === 0x20) || (ch === 0x09) || (ch === 0x0B) || (ch === 0x0C) || (ch === 0xA0) || | ||
(ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0); | ||
return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || | ||
ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0; | ||
} | ||
@@ -81,3 +81,3 @@ | ||
function isLineTerminator(ch) { | ||
return (ch === 0x0A) || (ch === 0x0D) || (ch === 0x2028) || (ch === 0x2029); | ||
return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029; | ||
} | ||
@@ -94,30 +94,33 @@ | ||
IDENTIFIER_START = new Array(0x80); | ||
for(ch = 0; ch < 0x80; ++ch) { | ||
IDENTIFIER_START[ch] = | ||
ch >= 0x61 && ch <= 0x7A || // a..z | ||
ch >= 0x41 && ch <= 0x5A || // A..Z | ||
ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) | ||
} | ||
IDENTIFIER_PART = new Array(0x80); | ||
for(ch = 0; ch < 0x80; ++ch) { | ||
IDENTIFIER_PART[ch] = | ||
ch >= 0x61 && ch <= 0x7A || // a..z | ||
ch >= 0x41 && ch <= 0x5A || // A..Z | ||
ch >= 0x30 && ch <= 0x39 || // 0..9 | ||
ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore) | ||
} | ||
function isIdentifierStartES5(ch) { | ||
return (ch >= 97 && ch <= 122) || // a..z | ||
(ch >= 65 && ch <= 90) || // A..Z | ||
(ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) | ||
((ch >= 0x80) && ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch))); | ||
return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); | ||
} | ||
function isIdentifierPartES5(ch) { | ||
return (ch >= 97 && ch <= 122) || // a..z | ||
(ch >= 65 && ch <= 90) || // A..Z | ||
(ch >= 48 && ch <= 57) || // 0..9 | ||
(ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) | ||
((ch >= 0x80) && ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch))); | ||
return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); | ||
} | ||
function isIdentifierStartES6(ch) { | ||
return (ch >= 97 && ch <= 122) || // a..z | ||
(ch >= 65 && ch <= 90) || // A..Z | ||
(ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) | ||
((ch >= 0x80) && ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch))); | ||
return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch)); | ||
} | ||
function isIdentifierPartES6(ch) { | ||
return (ch >= 97 && ch <= 122) || // a..z | ||
(ch >= 65 && ch <= 90) || // A..Z | ||
(ch >= 48 && ch <= 57) || // 0..9 | ||
(ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore) | ||
((ch >= 0x80) && ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch))); | ||
return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch)); | ||
} | ||
@@ -124,0 +127,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"main": "lib/utils.js", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"engines": { | ||
@@ -9,0 +9,0 @@ "node": ">=0.10.0" |
498
49261