Skip to content
This repository was archived by the owner on Mar 5, 2019. It is now read-only.
/ js-config Public archive

Simple library to get config value from a given object, supports nested values.

License

Notifications You must be signed in to change notification settings

DVS-devtools/js-config

Repository files navigation

js-config

[!!!] The source code of this package is on https://github.com/docomodigital/js-utils, this repository will be removed asap

Build Status Coverage Status npm version Greenkeeper badge

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-config/latest

or run the following command inside the js-config folder:

npm run doc:open

About

Simple library to get config value from a given object, supports nested values.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •