New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.0 to 1.0.1

28

index.js

@@ -271,2 +271,16 @@ var backslash = require('backslash');

var obj = {};
var j = startInd;
while (_isWhiteSpace(str[j])) {
j++;
}
if (str[j] === '}') {
return {
start: startInd,
end: j,
value: obj
};
}
while (sepValue === ',') {

@@ -323,2 +337,16 @@ var key = _findKey(str, i);

var arr = [];
var j = startInd;
while (_isWhiteSpace(str[j])) {
j++;
}
if (str[j] === ']') {
return {
start: startInd,
end: j,
value: arr
};
}
while (sepValue === ',') {

@@ -325,0 +353,0 @@ var value = _findValue(str, i);

2

package.json
{
"name": "json-dup-key-validator",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [

@@ -12,3 +12,3 @@ [

"v"
}
}, {}
]

@@ -5,4 +5,6 @@ {

"with back spash\\": {
"nested": [null, true, false ]
"nested": [null, true, false ],
"nestedEmptyArr": [],
"nestedEmptyObj": {}
}
}

@@ -7,2 +7,20 @@ var fs = require('fs');

describe('test', function() {
it('should validate empty object', function() {
var emptyArr = '[]';
var emptyObj = '{}';
var emptyStr = '""';
expect(validator.parse(emptyArr, false)).to.deep.equal([]);
expect(validator.parse(emptyArr, true)).to.deep.equal([]);
expect(validator.parse(emptyObj, false)).to.deep.equal({});
expect(validator.parse(emptyObj, true)).to.deep.equal({});
expect(validator.parse(emptyStr, false)).to.deep.equal("");
expect(validator.parse(emptyStr, true)).to.deep.equal("");
expect(validator.validate(emptyArr, false)).to.equal(undefined);
expect(validator.validate(emptyObj, false)).to.equal(undefined);
expect(validator.validate(emptyStr, false)).to.equal(undefined);
});
it('valid json', function() {

@@ -20,3 +38,3 @@ var validJson = [{

"k": "v"
}
}, {}
]

@@ -38,3 +56,5 @@ }, {

false
]
],
"nestedEmptyArr": [],
"nestedEmptyObj": {}
}

@@ -41,0 +61,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