2.3.1 • Published 10 years ago
@tridnguyen/config v2.3.1
config
Import config from file safely with defaults
Installation
:; npm install --save @tridnguyen/configUsage
var config = require('@tridnguyen/config');
var options = config({
a: 'default',
b: 'value'
}, 'config.json');Options
config(defaults, configPath, opts)
- defaults {Object} - default options for config. Defaults to
{} - configPath {String} - the path to the config file. It could be either a JSON or JS file
- opts.caller {Boolean} - whether the config file path is relative to the script that calls
config, or relative to the current working directory (process.cwd()). Defaults totrue - opts.verbose {Boolean} - verbose Defaults to
false