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

jsonfile

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonfile - npm Package Compare versions

Comparing version 2.2.2 to 2.2.3

4

CHANGELOG.md

@@ -0,1 +1,5 @@

2.2.3 / 2015-10-14
------------------
- include file name in parse error. See: https://github.com/jprichardson/node-jsonfile/pull/34
2.2.2 / 2015-09-16

@@ -2,0 +6,0 @@ ------------------

15

index.js

@@ -16,2 +16,3 @@ var fs = require('fs')

} catch (err2) {
err2.message = file + ': ' + err2.message
return callback(err2)

@@ -31,9 +32,11 @@ }

var shouldThrow = 'throws' in options ? options.throws : true
var content = fs.readFileSync(file, options)
if (shouldThrow) { // i.e. throw on invalid JSON
return JSON.parse(fs.readFileSync(file, options), options.reviver)
} else {
try {
return JSON.parse(fs.readFileSync(file, options), options.reviver)
} catch (err) {
try {
return JSON.parse(content, options.reviver)
} catch (err) {
if (shouldThrow) {
err.message = file + ': ' + err.message
throw err
} else {
return null

@@ -40,0 +43,0 @@ }

{
"name": "jsonfile",
"version": "2.2.2",
"version": "2.2.3",
"description": "Easily read/write JSON files.",

@@ -5,0 +5,0 @@ "repository": {

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