You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
422 B
12 lines
422 B
'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);
|