@docomodigital/js-config
v3.0.2js-config
Simple library to get config value from a given object, supports nested values.
Usage
import Config from '@docomodigital/js-config';
const configObject = {
host: 'https://example.com',
api: {
version: 'v1',
routes: {}
},
foo: {
bar: 'test'
}
}
Config.init({
config: configObject,
});
Config.get('api.version'); // 'v1'
Config.get('foo'); // { bar: 'test' }
If Config is initialized with the flag upperCase: true
, the keys are searched in uppercase:
Config.init({
config: { KEY: 'value' },
upperCase: true
});
Config.get('key'); // 'value'
Installation
NPM
npm install --save @docomodigital/js-config
Documentation
To read documentation, go to:
npm i @docomodigital/js-config
Metadata
- MIT
- Whatever
- Unknown
- released 12/16/2019