Comparing version 2.1.0 to 2.1.1
@@ -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 @@ ------------------ |
@@ -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": { |
30
test.js
@@ -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 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15152
278
0