node/deps/npm/node_modules/stringify-package/index.js
isaacs 3ebaf6b9bc deps: update npm to 6.12.0
Update npm to 6.12.0

Now `npm ci` runs prepare scripts for git dependencies, and respects the
`--no-optional` argument.  Warnings for `engine` mismatches are printed
again.  Various other fixes and cleanups.

PR-URL: https://github.com/nodejs/node/pull/29885
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Christian Clauss <cclauss@me.com>
2019-10-15 11:00:21 -07:00

19 lines
367 B
JavaScript

'use strict'
module.exports = stringifyPackage
const DEFAULT_INDENT = 2
const CRLF = '\r\n'
const LF = '\n'
function stringifyPackage (data, indent, newline) {
indent = indent || (indent === 0 ? 0 : DEFAULT_INDENT)
const json = JSON.stringify(data, null, indent)
if (newline === CRLF) {
return json.replace(/\n/g, CRLF) + CRLF
}
return json + LF
}