2 const path = require('path');
3 const fs = require('graceful-fs');
4 const stripBom = require('strip-bom');
5 const parseJson = require('parse-json');
6 const pify = require('pify');
8 const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp));
10 module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp));
11 module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp);