json-dup-key-validator
Advanced tools
Comparing version 1.0.2 to 1.0.3
15
index.js
@@ -134,2 +134,4 @@ var backslash = require('backslash'); | ||
var dotFound = false; | ||
var exponentInd; | ||
var exponentPostNumberCount = 0; | ||
var whiteSpaceInNumber = false; | ||
@@ -199,5 +201,12 @@ var value; | ||
} else if (_isNumber(ch) && !whiteSpaceInNumber) { | ||
if (exponentInd) { | ||
exponentPostNumberCount++; | ||
} | ||
continue; | ||
} else if (ch === '.' && !dotFound && !whiteSpaceInNumber) { | ||
} else if (ch === '.' && !dotFound && !exponentInd && !whiteSpaceInNumber) { | ||
dotFound = true; | ||
} else if ((ch === 'e' || ch === 'E') && !exponentInd && !whiteSpaceInNumber) { | ||
exponentInd = i; | ||
} else if ((ch === '+' || ch === '-') && exponentInd === i - 1 && !whiteSpaceInNumber) { | ||
continue; | ||
} else { | ||
@@ -210,2 +219,6 @@ throw _syntaxError(str, i, 'expecting number'); | ||
if (isNumber && exponentInd && !exponentPostNumberCount) { | ||
throw _syntaxError(str, i, 'expecting number'); | ||
} | ||
if (valueEndInd === undefined) { | ||
@@ -212,0 +225,0 @@ if (isNumber) { |
{ | ||
"name": "json-dup-key-validator", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"chai": "^3.5.0", | ||
"gulp": "^3.9.1", | ||
"gulp": "^4.0.2", | ||
"gulp-mocha": "^2.2.0", | ||
@@ -33,0 +33,0 @@ "mocha": "^2.4.5" |
@@ -68,2 +68,8 @@ var fs = require('fs'); | ||
}, { | ||
path: './test/fixture/valid-scientific-number.json', | ||
expectedValue: 1.23e+45 | ||
}, { | ||
path: './test/fixture/valid-signed-scientific-number.json', | ||
expectedValue: 1.23e+45 | ||
}, { | ||
path: './test/fixture/valid-to-string.json', | ||
@@ -96,2 +102,14 @@ expectedValue: { | ||
expectedError: 'Syntax error: expecting number near 3.112-24\n]' | ||
}, { | ||
path: './test/fixture/invalid-scientific-number-two-e.json', | ||
expectedError: 'Syntax error: expecting number near 123e3E5' | ||
}, { | ||
path: './test/fixture/invalid-scientific-number-decimal-after-e.json', | ||
expectedError: 'Syntax error: expecting number near 123e4.56' | ||
}, { | ||
path: './test/fixture/invalid-scientific-number-missing-exponent-digits.json', | ||
expectedError: 'Syntax error: expecting number near 123e' | ||
}, { | ||
path: './test/fixture/invalid-signed-scientific-number.json', | ||
expectedError: 'Syntax error: expecting number near 123e4+56' | ||
}]; | ||
@@ -98,0 +116,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
20742
22
638