mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 21:51:40 +00:00
update
This commit is contained in:
21
node_modules/load-json-file/index.js
generated
vendored
Normal file
21
node_modules/load-json-file/index.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
var path = require('path');
|
||||
var fs = require('graceful-fs');
|
||||
var stripBom = require('strip-bom');
|
||||
var parseJson = require('parse-json');
|
||||
var Promise = require('pinkie-promise');
|
||||
var pify = require('pify');
|
||||
|
||||
function parse(x, fp) {
|
||||
return parseJson(stripBom(x), path.relative(process.cwd(), fp));
|
||||
}
|
||||
|
||||
module.exports = function (fp) {
|
||||
return pify(fs.readFile, Promise)(fp, 'utf8').then(function (data) {
|
||||
return parse(data, fp);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.sync = function (fp) {
|
||||
return parse(fs.readFileSync(fp, 'utf8'), fp);
|
||||
};
|
Reference in New Issue
Block a user