{"name":"map-config","description":"Map configuration objects to application methods.","version":"0.4.0","homepage":"https://github.com/doowb/map-config","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"repository":{"type":"git","url":"git+https://github.com/doowb/map-config.git"},"bugs":{"url":"https://github.com/doowb/map-config/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"devDependencies":{"base-methods":"^0.4.0","gulp":"^3.9.0","gulp-eslint":"^1.0.0","gulp-istanbul":"^0.10.2","gulp-mocha":"^2.1.3","mocha":"^2.3.3"},"verb":{"related":{"list":["assemble","generate","templates","update","verb"]}},"dependencies":{"async":"^1.5.2"},"contributors":[{"name":"Brian Woodward","email":"brian.woodward@gmail.com","url":"https://github.com/doowb"},{"name":"Jon Schlinkert","email":"github@sellside.com","url":"https://github.com/jonschlinkert"}],"keywords":["config","configuration","settings"],"gitHead":"e4629418a37fc3a0c2224f1b0c1798f05752861e","_id":"map-config@0.4.0","_shasum":"6a0510ec296d47369bda340e3b344851bc85f7d5","_from":".","_npmVersion":"3.5.2","_nodeVersion":"5.1.1","_npmUser":{"name":"doowb","email":"brian.woodward@gmail.com"},"dist":{"shasum":"6a0510ec296d47369bda340e3b344851bc85f7d5","tarball":"http://registry-npm.ywwl.com/map-config/download/map-config-0.4.0.tgz","integrity":"sha512-4O7vnM2b6QvFNW/O5+rwmpf1AhwsSSj3a/8Ltyn9X9s2EiJTMHfzHy3Ro4xyB6HETxbObOkSai7WV8J9ifsV6Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHF65VBuTwCc9lEN7Ngm3R7dAUlrYYJh/5TE5BLoL5NoAiBHuVL4OfcKvIl9Q2aw7gFyJ/+pKu7e3WzRdkFsXNCZqA=="}],"size":4136,"noattachment":false,"key":"/map-config/-/map-config-0.4.0.tgz"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"readme":"# map-config [![NPM version](https://img.shields.io/npm/v/map-config.svg)](https://www.npmjs.com/package/map-config) [![Build Status](https://img.shields.io/travis/doowb/map-config.svg)](https://travis-ci.org/doowb/map-config)\n\n> Map configuration objects to application methods.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm i map-config --save\n```\n\n## Usage\n\n```js\nvar MapConfig = require('map-config');\n```\n\n## API\n\n### [MapConfig](index.js#L24)\nCreate a new instance of MapConfig with a specified map and application.\n\n**Params**\n\n* `app` **{Object}**: Object containing the methods that will be called based on the map specification.    \n* `map` **{Object}**: Optional object specifying how to map a configuration to an application.    \n\n**Example**\n\n```js\nvar mapper = new MapConfig(app, map);\n```\n\n### [.map](index.js#L63)\nMap properties to methods and/or functions.\n\n**Params**\n\n* `key` **{String}**: property key to map.    \n* `val` **{Function|Object}**: Optional function to call when a config has the given key. Functions will be passed `(val, key, config)` when called. Functions may also take a callback to indicate async usage. May also pass another instance of MapConfig to be processed.    \n* `returns` **{Object}** `this`: to enable chaining  \n\n**Example**\n\n```js\nmapper\n  .map('baz')\n  .map('bang', function(val, key, config) {\n  });\n```\n\n### [.alias](index.js#L122)\nCreate an `alias` for property `key`.\n\n**Params**\n\n* `alias` **{String}**: Alias to use for `key`.    \n* `key` **{String}**: Actual property or method on `app`.    \n* `returns` **{Object}**: Returns the instance for chaining.  \n\n**Example**\n\n```js\nmapper.alias('foo', 'bar');\n```\n\n### [.process](index.js#L143)\nProcess a configuration object with the already configured `map` and `app`.\n\n**Params**\n\n* `config` **{Object}**: Configuration object to map to application methods.    \n* `cb` **{Function}**: Optional callback function that will be called when finished or if an error occurs during processing.    \n\n**Example**\n\n```js\nmapper.process(config);\n```\n\n### [.addKey](index.js#L217)\nAdd 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.\n\n**Params**\n\n* `key` **{String}**: key to push onto `.keys`    \n* `arr` **{Array}**: Array of sub keys to push onto `.keys`    \n* `returns` **{Object}** `this`: for chaining  \n\n**Example**\n\n```js\nmapper.addKey('foo');\nconsole.log(mapper.keys);\n//=> ['foo']\n\nvar one = new MapConfig();\nvar two = new MapConfig();\ntwo.map('foo');\ntwo.map('bar');\ntwo.map('baz');\n\n// map config `two` to config `one`\none.map('two', function(val, key, config, next) {\n  two.process(val, next);\n});\n\n// map keys from config `two` to config `one`\none.addKey('two', two.keys);\nconsole.log(one.keys);\n//=> ['two.foo', 'two.bar', 'two.baz']\n```\n\n## Related projects\n* [assemble](https://www.npmjs.com/package/assemble): Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… [more](https://www.npmjs.com/package/assemble) | [homepage](https://github.com/assemble/assemble)\n* [generate](https://www.npmjs.com/package/generate): Fast, composable, highly extendable project generator with a user-friendly and expressive API. | [homepage](https://github.com/generate/generate)\n* [templates](https://www.npmjs.com/package/templates): System for creating and managing template collections, and rendering templates with any node.js template engine.… [more](https://www.npmjs.com/package/templates) | [homepage](https://github.com/jonschlinkert/templates)\n* [update](https://www.npmjs.com/package/update): Easily keep anything in your project up-to-date by installing the updaters you want to use… [more](https://www.npmjs.com/package/update) | [homepage](https://github.com/update/update)\n* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://www.npmjs.com/package/verb) | [homepage](https://github.com/verbose/verb)\n\n## Running tests\nInstall dev dependencies:\n\n```sh\n$ npm i -d && npm test\n```\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/doowb/map-config/issues/new).\n\n## Author\n**Brian Woodward**\n\n+ [github/doowb](https://github.com/doowb)\n+ [twitter/doowb](http://twitter.com/doowb)\n\n## License\nCopyright © 2016 [Brian Woodward](https://github.com/doowb)\nReleased under the [MIT license](https://github.com/doowb/map-config/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb), v0.1.0, on February 23, 2016._\n","publish_time":1453069036530,"_cnpm_publish_time":1453069036530,"dist-tags":{"latest":"0.5.0"}}