diff options
author | Kat Marchán <kzm@zkat.tech> | 2018-08-29 12:03:09 -0700 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-09-06 08:53:57 +0200 |
commit | 6d6db603e299b2df82fd1d451b83de60c60fc082 (patch) | |
tree | d2c69476aeef34282e4c866461be0440d31b3f73 /deps/npm/node_modules/stringify-package/index.js | |
parent | cab8a0bd924c5ac2bbbdf971631f057960f084e4 (diff) | |
download | node-new-6d6db603e299b2df82fd1d451b83de60c60fc082.tar.gz |
deps: upgrade npm to 6.4.1
PR-URL: https://github.com/nodejs/node/pull/22591
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'deps/npm/node_modules/stringify-package/index.js')
-rw-r--r-- | deps/npm/node_modules/stringify-package/index.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/deps/npm/node_modules/stringify-package/index.js b/deps/npm/node_modules/stringify-package/index.js new file mode 100644 index 0000000000..0cc9de0a36 --- /dev/null +++ b/deps/npm/node_modules/stringify-package/index.js @@ -0,0 +1,17 @@ +'use strict' + +module.exports = stringifyPackage + +const DEFAULT_INDENT = 2 +const CRLF = '\r\n' +const LF = '\n' + +function stringifyPackage (data, indent, newline) { + const json = JSON.stringify(data, null, indent || DEFAULT_INDENT) + + if (newline === CRLF) { + return json.replace(/\n/g, CRLF) + CRLF + } + + return json + LF +} |