@docomodigital/js-config

3.0.2 • Public • Published

js-config

npm version

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:

http://docomodigital.github.io/js-utils/js-config/latest

Readme

Keywords

none

Package Sidebar

Install

npm i @docomodigital/js-config

Weekly Downloads

11

Version

3.0.2

License

MIT

Unpacked Size

14.9 kB

Total Files

10

Last publish

Collaborators

  • everdrone
  • blame_etc