2.3.1 • Published 9 years ago

@tridnguyen/config v2.3.1

Weekly downloads
7,479
License
MIT
Repository
github
Last release
9 years ago

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