summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/stringify-package/index.js
diff options
context:
space:
mode:
authorKat Marchán <kzm@zkat.tech>2018-08-29 12:03:09 -0700
committerMichaël Zasso <targos@protonmail.com>2018-09-06 08:53:57 +0200
commit6d6db603e299b2df82fd1d451b83de60c60fc082 (patch)
treed2c69476aeef34282e4c866461be0440d31b3f73 /deps/npm/node_modules/stringify-package/index.js
parentcab8a0bd924c5ac2bbbdf971631f057960f084e4 (diff)
downloadnode-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.js17
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
+}