{"name":"map-config","description":"Map configuration objects to application methods.","version":"0.4.4","homepage":"https://github.com/doowb/map-config","author":{"name":"Brian Woodward","url":"https://github.com/doowb"},"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"}],"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"},"dependencies":{"array-unique":"^0.2.1","async":"^1.5.2"},"devDependencies":{"base":"^0.6.7","gulp":"^3.9.0","gulp-eslint":"^1.0.0","gulp-format-md":"^0.1.5","gulp-istanbul":"^0.10.2","gulp-mocha":"^2.1.3","mocha":"*"},"keywords":["config","configuration","settings"],"verb":{"tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["assemble","generate","templates","update","verb"]}},"gitHead":"02957db51f693e36879cdaf7dd649a1d5ba2270e","_id":"map-config@0.4.4","_shasum":"fdcd92205f4a02c9acd3512d163953337cf3e68e","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"doowb","email":"brian.woodward@gmail.com"},{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"fdcd92205f4a02c9acd3512d163953337cf3e68e","tarball":"http://registry-npm.ywwl.com/map-config/download/map-config-0.4.4.tgz","integrity":"sha512-Gu4LROniL4j2tDyn+E5oDkXu+aTqCahHv3wco8kK21mcV0qFNBQd12DA/hCb/MLhtu4RGWz6I+Q1zedlVhGY9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHqqsJlDhC4Xh3UYOA6fqQZ7mMqAWRXI+tZKRsSdyazPAiEApYLSy1lcSezpYxpH0OpfL/3lRJudzzgmi9Jn9z/OflI="}],"size":4581,"noattachment":false,"key":"/map-config/-/map-config-0.4.4.tgz"},"_npmOperationalInternal":{"host":"packages-6-west.internal.npmjs.com","tmp":"tmp/map-config-0.4.4.tgz_1455520533587_0.983779348898679"},"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":1455520537221,"_cnpm_publish_time":1455520537221,"dist-tags":{"latest":"0.5.0"}}