UNPKG

359 BJavaScriptView Raw
1var fs = require('fs');
2
3var helpers = {};
4
5/**
6 * Read any file as JSON. Unfortunately require can't read a file as JSON unless
7 * it has a .json extension, so this will simulate using require.
8 * @param {string} path
9 * @returns {*}
10 */
11helpers.requireJSON = function(path) {
12 return JSON.parse(fs.readFileSync(path, 'utf8'));
13};
14
15module.exports = helpers;
\No newline at end of file