From 599206dea0cf283464e85b32669f44ac21d6d551 Mon Sep 17 00:00:00 2001 From: Michael Milton Date: Sun, 22 Nov 2015 00:39:49 +0100 Subject: [PATCH] Added quoting for capitalised identifiers --- index.js | 2 +- test/index.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4c66afa..a572a9e 100644 --- a/index.js +++ b/index.js @@ -139,7 +139,7 @@ exports.literal = function(val){ function validIdent(id) { if (reserved[id]) return false; - return /^[a-z_][a-z0-9_$]*$/i.test(id); + return /^[a-z_][a-z0-9_$]*$/.test(id); } /** diff --git a/test/index.js b/test/index.js index 10baaa8..69d2d2f 100644 --- a/test/index.js +++ b/test/index.js @@ -72,6 +72,7 @@ describe('escape.ident(val)', function(){ escape.ident('_foo_bar$baz').should.equal('_foo_bar$baz'); escape.ident('test.some.stuff').should.equal('"test.some.stuff"'); escape.ident('test."some".stuff').should.equal('"test.""some"".stuff"'); + escape.ident('someStuff').should.equal('"someStuff"'); }) it('should quote reserved words', function(){