npm.io
2.3.1 • Published 10 years ago

@tridnguyen/config

Licence
MIT
Version
2.3.1
Deps
5
Vulns
0
Weekly
0

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 to true
  • opts.verbose {Boolean} - verbose Defaults to false

Keywords