reduce false positives from labels (#2934)
authorAlex Lam S.L <alexlamsl@gmail.com>
Sun, 18 Feb 2018 19:55:33 +0000 (03:55 +0800)
committerGitHub <noreply@github.com>
Sun, 18 Feb 2018 19:55:33 +0000 (03:55 +0800)
test/sandbox.js

index 2c2c21a..d823866 100644 (file)
@@ -42,7 +42,7 @@ var FUNC_TOSTRING = [
     "        }",
     "        var body = toString.call(this);",
     '        body = body.slice(body.indexOf("{") + 1, -1);',
-    '        if (/^(?:\\s|\\{|\\}|;|[0-9\\.]+|"[^"]*"|var [^=;]+|\\/\\/.*|\\/\\*[\\s\\S]*\\*\\/)*(?:$|return(?:;|\\n))/.test(body)) {',
+    '        if (/^(?:\\s|\\{|\\}|;|[0-9\\.]+|"[^"]*"|\\w+:|var [^=;]+|\\/\\/.*|\\/\\*[\\s\\S]*\\*\\/)*(?:$|return(?:;|\\n))/.test(body)) {',
     '            body = "";',
     "        } else {",
     '            body = n + "' + function() {