JSPM

merge-settings

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q33543F
  • License MIT

Load and merge configuration settings from multiple sources, in a specific order, and normalized according to a schema.

Package Exports

  • merge-settings

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (merge-settings) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

merge-settings NPM version Build Status

Load and merge configuration settings from multiple sources, in a specific order, and normalized according to a schema.

Install

Install with npm:

$ npm install merge-settings --save

Usage

var Settings = require('merge-settings');

API

Settings

Create an instance of Settings.

.set

Add a config object to be merged.

Params

  • object {Object}: The object to merge into the config.

Example

config
  .addConfig({a: 'b', c: 'd'})
  .addConfig({a: 'z'})
  .merge();

//=> {a: 'z', c: 'd'}

.get

Get the normalized value of property key from the cache.

Params

  • key {String}
  • returns {any}: The normalized value of key

Example

config.get('foo');

.getRaw

Get the raw (non-normalized) value of property key from the cache.

Params

  • key {String}
  • returns {any}: The value of key

Example

config.get('foo');

.addConfig

Add a config object to be merged.

Params

  • object {Object}: The object to merge into the config.

Example

config
  .addConfig({a: 'b', c: 'd'})
  .addConfig({a: 'z'})
  .merge();

//=> {a: 'z', c: 'd'}

.addConfigs

Add an array or list of config objects to be merged.

Params

  • object {Object}: The object to merge into the config.

Example

config
  .addConfigs({a: 'b'}, {c: 'd'})
  .addConfigs([{a: 'b'}, {c: 'd'}])

.merge

Merge normalized config objects.

Params

  • config {Object}

Example

var config = {};
configs.merge(config);
  • base: base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… more | homepage
  • data-store: Easily get, set and persist config data. | homepage
  • extend-shallow: Extend an object with the properties of additional objects. node.js/javascript util. | homepage
  • mixin-deep: Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

Generate readme and API documentation with verb:

$ npm install verb && npm run docs

Or, if verb is installed globally:

$ verb

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Jon Schlinkert

License

Copyright © 2016 Jon Schlinkert Released under the MIT license.


This file was generated by verb, v0.9.0, on March 21, 2016.