Always quote property names that contain non-ASCII characters.
authorMihai Bazon <mihai@bazon.net>
Fri, 18 Apr 2014 07:47:38 +0000 (10:47 +0300)
committerMihai Bazon <mihai@bazon.net>
Fri, 18 Apr 2014 07:48:44 +0000 (10:48 +0300)
Fix #328

lib/parse.js

index b061067..de982b1 100644 (file)
@@ -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) {