From 8fbe20001215887275b3cf053be675ebdbf331a9 Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Fri, 18 Apr 2014 10:47:38 +0300 Subject: [PATCH] Always quote property names that contain non-ASCII characters. Fix #328 --- lib/parse.js | 9 +-------- 1 file changed, 1 insertion(+), 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) { -- 2.34.1