$ npm install jfig
JSON file loader or JSON pass through.
I needed a way to not have to know if the data passed into the function was a file path or an object. If it is a filename, this module tries to load the file. If it is an object, it just returns the object.
npm install jfig --save
File path
var jfig = require('jfig');
var something = __dirname + '/config.json';
var config = jfig(something);
Object pass through
var jfig = require('jfig');
var something = {
type: 'object'
};
var config = jfig(something);
data - file path or object to parseoptions
root - the root path if a file path is providedpluck - a string or array of keys to plucks the values out of the config file or objectnpm install
npm test
© 2010 - cnpmjs.org x YWFE | Home | YWFE