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

ian-parse-json

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ian-parse-json - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

13

index.js

@@ -1,3 +0,12 @@

module.exports = {
JSON: (json) => JSON.parse(json)
/**
* Ian parses JSON
* @param {String} json some JSON for Ian to parse
* @return {Object} the JSON, parsed by Ian
*/
class Ian {
parse(json) {
return JSON.parse(json);
}
}
module.exports = Ian;

2

package.json
{
"name": "ian-parse-json",
"version": "1.0.1",
"version": "2.0.0",
"description": "supermooi",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,7 +8,9 @@ # ian-parse-json

```javascript
const parse = require('ian-parse-json');
const Ian = require('ian-parse-json');
const parsedJSON = parse.JSON("{\"name\":\"ian\"}");
const ian = new Ian();
const parsedJSON = ian.parse("{\"name\":\"ian\"}");
console.log(parsedJSON); // {name: 'ian'}
```

@@ -1,12 +0,14 @@

const parse = require('../index');
const Ian = require('../index');
const expect = require('chai').expect;
const ian = new Ian();
describe('JSON parser', () => {
it('parses JSON', () => {
expect(parse.JSON("{\"name\":\"ian\"}")).to.deep.equal({name: 'ian'});
expect(ian.parse("{\"name\":\"ian\"}")).to.deep.equal({name: 'ian'});
});
it('fails when no valid JSON is given', () => {
expect(() => { parse.JSON('malle henkie'); }).to.throw(SyntaxError);
expect(() => { ian.parse('malle henkie'); }).to.throw(SyntaxError);
});
});
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