Skip to content

Latest commit

 

History

History
63 lines (50 loc) · 1.07 KB

.verb.md

File metadata and controls

63 lines (50 loc) · 1.07 KB

Usage

var config = require('{%= name %}');
var base = require('base');
var app = base();

// register the plugin
app.use(config());

Mapped methods

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 custom methods

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.

// call `config` as a function
app.config({
  set: function(val) {
    app.set(val);
  }
});
// or use the `map` method
app.config
  .map('set')
  .map('get')
  .map('has');

Process

Iterate over each property on the given object or array of objects, and call the mapped method that matches property key.

//=> calls `app.set('foo', 'bar');
app.config.process({set: {foo: 'bar'}}, function(err) {
  if (err) throw err;
});

API

{%= apidocs("index.js") %}