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

json-parser

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-parser - npm Package Compare versions

Comparing version 0.2.4 to 1.0.0

4

package.json
{
"name": "json-parser",
"version": "0.2.4",
"version": "1.0.0",
"description": "JSON parser to parse JSON object and MAINTAIN comments.",

@@ -36,4 +36,4 @@ "main": "index.js",

"dependencies": {
"esprima": "^1.2.2"
"esprima": "^2.4.1"
}
}

@@ -1,3 +0,7 @@

# json-parser [![NPM version](https://badge.fury.io/js/json-parser.svg)](http://badge.fury.io/js/json-parser) [![Build Status](https://travis-ci.org/kaelzhang/node-json-parser.svg?branch=master)](https://travis-ci.org/kaelzhang/node-json-parser) [![Dependency Status](https://gemnasium.com/kaelzhang/node-json-parser.svg)](https://gemnasium.com/kaelzhang/node-json-parser)
[![NPM version](https://badge.fury.io/js/json-parser.svg)](http://badge.fury.io/js/json-parser)
[![Build Status](https://travis-ci.org/kaelzhang/node-json-parser.svg?branch=master)](https://travis-ci.org/kaelzhang/node-json-parser)
[![Dependency Status](https://gemnasium.com/kaelzhang/node-json-parser.svg)](https://gemnasium.com/kaelzhang/node-json-parser)
# json-parser
JSON parser to parse JSON object and MAINTAIN comments.

@@ -16,3 +20,4 @@

content
```
```js
/**

@@ -19,0 +24,0 @@ blah

@@ -78,2 +78,38 @@ 'use strict';

});
});
});
var invalid = [
'{',
'}',
'[',
'',
'{a:1}',
'{"a":a}',
'{"a":undefined}'
];
// ECMA262 does not define the standard of error messages.
// However, we throw error messages the same as JSON.parse()
describe("error messages", function(){
invalid.forEach(function (i) {
it('error message:' + i, function(){
var error;
var err;
try {
parser.parse(i);
} catch(e) {
error = e;
}
try {
JSON.parse(i);
} catch(e) {
err = e;
}
expect(!!(err && error)).to.equal(true);
expect(error.message).to.equal(err.message);
});
});
});
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