Skip to content

Merges options from environment config, class defaults and instance options

License

Notifications You must be signed in to change notification settings

NOD-studios/configuration

Repository files navigation

@nod/configuration

Merges environment config, default properties and runtime options.

You can add strict type checking for configuration object parameters with Merger class. See below for details.

Supports ES5, ES7, AMD, CommonJS, System and EcmaScript modules.

GitHub tag Build status Dependency Status Join the chat

Usage:

Installation:

npm install --save @nod/configuration

Examples:

Usage :

import { Configuration } from '@nod/configuration';

process.env.DUMMY_TEST = 'works';

class ExampleConfiguration extends Configuration {
  //add some default properties
  example = true;
}

let config = new ExampleConfiguration({
  example = false
};

console.log(config.example, config.dummy.test);
//outputs : false, 'works'

Typesafe :

See Test for full typesafe usage example.

Build and develop:

gulp
#will build and start watching for changes

or

npm run build
npm run watch

or

npm run default

Please check other available gulp tasks with:

gulp -T

TODO:

  • Gulp tasks as another dependency
  • More detailed inline docs

Support:

Send e-mail Join the chat

forthebadge by NOD studios

About

Merges options from environment config, class defaults and instance options

Resources

License

Stars

Watchers

Forks

Packages

No packages published