+7
-7
@@ -37,3 +37,3 @@ /*! | ||
| * writeJson('foo.json', pkg, { | ||
| * space: 2, | ||
| * indent: 2, | ||
| * replacer: function(value) { | ||
@@ -141,16 +141,16 @@ * // filter out properties | ||
| * @param {Function|Object} `replacer` Function or options object | ||
| * @param {String|Number} `space` The actual value to use for spacing, or the number of spaces to use. | ||
| * @param {String|Number} `indent` The actual value to use for spacing, or the number of spaces to use. | ||
| * @return {String} | ||
| */ | ||
| function stringify(value, replacer, space) { | ||
| function stringify(value, replacer, indent) { | ||
| if (isObject(replacer)) { | ||
| var opts = replacer; | ||
| replacer = opts.replacer; | ||
| space = opts.space || space; | ||
| indent = opts.indent; | ||
| } | ||
| if (space == null) { | ||
| space = 2; | ||
| if (indent == null) { | ||
| indent = 2; | ||
| } | ||
| return JSON.stringify(value, replacer, space); | ||
| return JSON.stringify(value, replacer, indent); | ||
| } | ||
@@ -157,0 +157,0 @@ |
+1
-1
| { | ||
| "name": "write-json", | ||
| "description": "Write a JSON file to disk, also creates intermediate directories in the destination path if they don't already exist.", | ||
| "version": "3.0.0", | ||
| "version": "3.0.1", | ||
| "homepage": "https://github.com/jonschlinkert/write-json", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
+5
-5
@@ -75,3 +75,3 @@ # write-json [](https://www.npmjs.com/package/write-json) [](https://npmjs.org/package/write-json) [](https://npmjs.org/package/write-json) [](https://travis-ci.org/jonschlinkert/write-json) | ||
| ### [writeJson](index.js#L59) | ||
| ### [writeJson](index.js#L58) | ||
@@ -108,3 +108,3 @@ Calls `JSON.stringify` on the given `value` then asynchronously writes the result to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Returns a promise if a callback function is not passed. | ||
| writeJson('foo.json', pkg, { | ||
| space: 2, | ||
| indent: 2, | ||
| replacer: function(value) { | ||
@@ -122,3 +122,3 @@ // filter out properties | ||
| ### [.promise](index.js#L85) | ||
| ### [.promise](index.js#L84) | ||
@@ -144,3 +144,3 @@ The promise version of [writeFile](#writefile). Returns a promise. | ||
| ### [.sync](index.js#L105) | ||
| ### [.sync](index.js#L104) | ||
@@ -163,3 +163,3 @@ The synchronous version of [writeFile](#writefile). Returns undefined. | ||
| ### [.stream](index.js#L130) | ||
| ### [.stream](index.js#L129) | ||
@@ -166,0 +166,0 @@ The stream version of [writeFile](#writefile). Returns a new [WriteStream](https://nodejs.org/api/fs.html#fs_class_fs_writestream) object. |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package