A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/doowb/map-config below:

doowb/map-config: Map configuration objects to application methods.

Map configuration objects to application methods.

Install with npm:

$ npm i map-config --save
var MapConfig = require('map-config');

Create a new instance of MapConfig with a specified map and application.

Params

Example

var mapper = new MapConfig(app, map);

Map properties to methods and/or functions.

Params

Example

mapper
  .map('baz')
  .map('bang', function(val, key, config) {
  });

Create an alias for property key.

Params

Example

mapper.alias('foo', 'bar');

Process a configuration object with the already configured map and app.

Params

Example

Add a key to the .keys array. May also be used to add an array of namespaced keys to the .keys array. Useful for mapping "sub-configs" to a key in a parent config.

Params

Example

mapper.addKey('foo');
console.log(mapper.keys);
//=> ['foo']

var one = new MapConfig();
var two = new MapConfig();
two.map('foo');
two.map('bar');
two.map('baz');

// map config `two` to config `one`
one.map('two', function(val, key, config, next) {
  two.process(val, next);
});

// map keys from config `two` to config `one`
one.addKey('two', two.keys);
console.log(one.keys);
//=> ['two.foo', 'two.bar', 'two.baz']

Install dev dependencies:

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

Brian Woodward

Copyright © 2016 Brian Woodward Released under the MIT license.

This file was generated by verb, v0.1.0, on February 23, 2016.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4