Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-dup-key-validator

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-dup-key-validator - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

test/fixture/invalid-scientific-number-decimal-after-e.json

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) {

4

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc