New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lite-json-parse

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lite-json-parse - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

6

package.json
{
"name": "lite-json-parse",
"version": "0.0.1",
"version": "0.0.2",
"description": "Lightweight JSON parse errback function",

@@ -19,3 +19,5 @@ "main": "index.js",

"lightweight",
"lite"
"lite",
"errback",
"nodeback"
],

@@ -22,0 +24,0 @@ "author": "Shawn Stedman",

# lite-json-parse
Lightweight JSON parse errback function
Reduce the boilerplate of wrapping every JSON.parse in a try/catch block. This no frills nanolibrary will safely parse JSON and return a javascript object or an error object in a node-style error-first callback function.
Use in node or in the browser.
### Example
```javascript
var parseJSON = require('lite-json-parse');
var json = "{\"food\":\"pizza\",\"drinks\":[\"soda\",\"red pop\",\"root beer\"]}";
parseJSON(json, function (err, pizzaParty) {
if (err) {
// handle parse error object
return console.log(err);
}
// success - have a pizza party!
pizzaParty.drinks.forEach(function(beverage) {
console.log(beverage);
});
});
```
:floppy_disk:
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