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.1.0 to 2.1.1

4

CHANGELOG.md

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

2.1.1 / 2015-06-19
------------------
- fixed regressions if `null` is passed for options. See: https://github.com/jprichardson/node-jsonfile/issues/24
2.1.0 / 2015-06-19

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

4

index.js

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

try {
obj = JSON.parse(data, options.reviver)
obj = JSON.parse(data, options ? options.reviver : null)
} catch (err2) {

@@ -47,3 +47,3 @@ return callback(err2)

try {
str = JSON.stringify(obj, options.replacer, this.spaces) + '\n'
str = JSON.stringify(obj, options ? options.replacer : null, this.spaces) + '\n'
} catch (err) {

@@ -50,0 +50,0 @@ if (callback) return callback(err, null)

{
"name": "jsonfile",
"version": "2.1.0",
"version": "2.1.1",
"description": "Easily read/write JSON files.",

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

@@ -61,2 +61,18 @@ var assert = require('assert')

})
describe('> when passing null and callback', function () {
it('should not throw an error', function () {
var file = path.join(TEST_DIR, 'somefile.json')
var obj = {
name: 'jp'
}
fs.writeFileSync(file, JSON.stringify(obj))
jf.readFile(file, null, function (err) {
assert.ifError(err)
assert.strictEqual(obj.name, 'jp')
})
})
})
})

@@ -176,2 +192,16 @@

})
describe('> when passing null and callback', function () {
it('should not throw an error', function (done) {
var file = path.join(TEST_DIR, 'somefile.json')
var obj = {
name: 'jp'
}
jf.writeFile(file, obj, null, function (err) {
assert.ifError(err)
done()
})
})
})
})

@@ -178,0 +208,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