3.0.1 • Published 5 years ago

conf-load v3.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

conf-load

CircleCI

load configuration based on namespaces and conventions.

install

npm install --save conf-load

usage

assuming you have

.
|
|---src
|   |---conf
|       |---foo.js
|       |---bar.js

with bar.js

module.exports = {
    some: 'thing',
    another: {
        thing: 'yeah'
    }
};

and foo.js

module.exports = { prop: 'value', woot: 'woot-value' };

then use conf-load

const {load} = require('conf-load');
const conf = load() // can pass options here

conf('foo.prop'); // > 'value'
conf('bar.another.thing'); // > 'yeah'

options

  • directory: string -> the folder to read through to find the config files (default './src/conf')
  • strict: boolean -> whether it should throw if it can not find a conf value at the corresponding path (default true) otherwise it returns undefined
3.0.1

5 years ago

3.0.0

5 years ago

2.0.0

6 years ago

1.0.4

7 years ago

1.0.3

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago