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

write-json

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

write-json - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

14

index.js

@@ -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 @@

{
"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)",

@@ -75,3 +75,3 @@ # write-json [![NPM version](https://img.shields.io/npm/v/write-json.svg?style=flat)](https://www.npmjs.com/package/write-json) [![NPM monthly downloads](https://img.shields.io/npm/dm/write-json.svg?style=flat)](https://npmjs.org/package/write-json) [![NPM total downloads](https://img.shields.io/npm/dt/write-json.svg?style=flat)](https://npmjs.org/package/write-json) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/write-json.svg?style=flat&label=Travis)](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.

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