base-methods plugin that adds a `config` method for mapping declarative configuration values to other 'base' methods or custom functions.
npm install base-config> base-methods plugin that adds a config method for mapping declarative configuration values to other 'base' methods or custom functions.
Install with npm:
``sh`
$ npm install base-config --save
`js
var config = require('base-config');
var base = require('base');
var app = base();
// register the plugin
app.use(config());
`
The following methods are mapped by default, but any of them can be overridden using app.config.map():
* .cwd.data
* .define
* .del
* .disable
* .disabled
* .enable
* .enabled
* .get
* .has
* .option
* .set
* .store
* .use
*
> Map properties on a configuration object to methods on app.
Each key on the given object should match the name of a method on app.
`jsconfig
// call as a functionmap
app.config({
set: function(val) {
app.set(val);
}
});
// or use the method`
app.config
.map('set')
.map('get')
.map('has');
Iterate over each property on the given object or array of objects, and call the mapped method that matches property key.
`jsapp.set('foo', 'bar');
//=> calls
app.config.process({set: {foo: 'bar'}}, function(err) {
if (err) throw err;
});
``
Create a function for mapping app properties onto theprop
given namespace.
Params
* prop {String}: The namespace to useargv
* {Object}returns
* {Object}
You might also be interested in these projects:
* base: base is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… more | homepage
* base-cli: Plugin for base-methods that maps built-in methods to CLI args (also supports methods from a… more | homepage
* base-data: adds a data method to base-methods. | homepageoption
* base-options: Adds a few options methods to base-methods, like , enable and disable. See the readme… more | homepage
* base-plugins: Upgrade's plugin support in base applications to allow plugins to be called any time after… more | homepage
* base-store: Plugin for getting and persisting config values with your base-methods application. Adds a 'store' object… more | homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Generate readme and API documentation with verb:
`sh`
$ npm install verb && npm run docs
Or, if verb is installed globally:
`sh`
$ verb
Install dev dependencies:
`sh``
$ npm install -d && npm test
Jon Schlinkert
* github/jonschlinkert
* twitter/jonschlinkert
Copyright © 2016, Jon Schlinkert.
Released under the MIT license.
*
_This file was generated by verb, v, on March 25, 2016._