diff options
author | Mihai Bazon <mihai@bazon.net> | 2014-04-18 10:47:38 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2014-04-18 10:48:44 +0300 |
commit | 8fbe20001215887275b3cf053be675ebdbf331a9 (patch) | |
tree | 9f252cfa22153a61357349425408c101b08874d5 | |
parent | 1a34a13e3393a9afd6a032b5c2bf3e29cbdfe153 (diff) | |
download | tracifyjs-8fbe20001215887275b3cf053be675ebdbf331a9.tar.gz tracifyjs-8fbe20001215887275b3cf053be675ebdbf331a9.zip |
Always quote property names that contain non-ASCII characters.
Fix #328
-rw-r--r-- | lib/parse.js | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/parse.js b/lib/parse.js index b061067e..de982b1e 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -168,14 +168,7 @@ function is_identifier_char(ch) { }; function is_identifier_string(str){ - var i = str.length; - if (i == 0) return false; - if (!is_identifier_start(str.charCodeAt(0))) return false; - while (--i >= 0) { - if (!is_identifier_char(str.charAt(i))) - return false; - } - return true; + return /^[a-z_$][a-z0-9_$]*$/i.test(str); }; function parse_js_number(num) { |