Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/load-json-file/index.js')
-rw-r--r--node_modules/load-json-file/index.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/node_modules/load-json-file/index.js b/node_modules/load-json-file/index.js
new file mode 100644
index 000000000..b2767e302
--- /dev/null
+++ b/node_modules/load-json-file/index.js
@@ -0,0 +1,11 @@
+'use strict';
+const path = require('path');
+const fs = require('graceful-fs');
+const stripBom = require('strip-bom');
+const parseJson = require('parse-json');
+const pify = require('pify');
+
+const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp));
+
+module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp));
+module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp);