json-parser
Advanced tools
Comparing version 1.1.4 to 1.1.5
11
index.js
@@ -81,3 +81,10 @@ 'use strict'; | ||
function walk () { | ||
switch (type()) { | ||
var tt = type(); | ||
var negative = ''; | ||
if (tt === '-') { | ||
next(); | ||
tt = type(); | ||
negative = '-'; | ||
} | ||
switch (tt) { | ||
case '{': | ||
@@ -95,3 +102,3 @@ next(); | ||
next(); | ||
return JSON.parse(value); | ||
return JSON.parse(negative + value); | ||
} | ||
@@ -98,0 +105,0 @@ |
{ | ||
"name": "json-parser", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "JSON parser to parse JSON object and MAINTAIN comments.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -76,2 +76,12 @@ 'use strict'; | ||
} | ||
}, | ||
{ | ||
// #8 | ||
d: 'support negative numbers', | ||
s: '{//a\n"a": -1}', | ||
o: '{"a": -1}', | ||
e: function (obj) { | ||
expect(obj.a).to.equal(-1); | ||
expect('// a' in obj).to.equal(true); | ||
} | ||
} | ||
@@ -78,0 +88,0 @@ ] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12519
359