@tridnguyen/config
v2.3.1
Published
Import config from file safely with defaults
Downloads
71,081
Maintainers
Readme
config
Import config from file safely with defaults
Installation
:; npm install --save @tridnguyen/config
Usage
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