{"name":"map-files","description":"Return an object for a glob of files. Pass a `rename` function for the keys, or a `parse` function for the content, allowing it to be used for readable or require-able files.","version":"0.3.0","homepage":"https://github.com/jonschlinkert/map-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git://github.com/jonschlinkert/map-files.git"},"bugs":{"url":"https://github.com/jonschlinkert/map-files/issues"},"licenses":[{"type":"MIT","url":"https://github.com/jonschlinkert/map-files/blob/master/LICENSE-MIT"}],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha -R spec"},"dependencies":{"globby":"^0.1.1","relative":"^0.1.6"},"devDependencies":{"gray-matter":"^1.0.1","mocha":"*","should":"^4.3.0"},"keywords":["dir","directories","directory","dirs","file","filepath","filepaths","files","hash","list","map","mapping","name","object","path","paths"],"_id":"map-files@0.3.0","_shasum":"4441c4a61928ce77966e1e00700846b67243bbb4","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"4441c4a61928ce77966e1e00700846b67243bbb4","tarball":"http://registry-npm.ywwl.com/map-files/download/map-files-0.3.0.tgz","integrity":"sha512-vXe92L3h9YGOIkyJ/4pnH0wQS6smcYmRN1YwfcMoUX2AerWaMmQQ7ZQoaqvoBLAWPXWF95yaXrdxmIv7IoVuXA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFLAfH70bmf1zkYnmSgTxE3T6usC0YiYVQwXXogzGKQ2AiEAtR9OAg6puyIHIqnkbqxAwPNaX49ago3M5APosAMAegs="}],"size":3986,"noattachment":false,"key":"/map-files/-/map-files-0.3.0.tgz"},"directories":{},"readme":"# map-files [![NPM version](https://img.shields.io/npm/v/map-files.svg?style=flat)](https://www.npmjs.com/package/map-files) [![NPM downloads](https://img.shields.io/npm/dm/map-files.svg?style=flat)](https://npmjs.org/package/map-files) [![Build Status](https://img.shields.io/travis/jonschlinkert/map-files.svg?style=flat)](https://travis-ci.org/jonschlinkert/map-files)\n\nReturn an object for a glob of files. Pass a `rename` function for the keys, or a `parse` function for the content, allowing it to be used for readable or require-able files.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install map-files --save\n```\n\n**Heads up!**\n\nBreaking changes in v0.8.0. See [the history](#history) for details.\n\n## Usage\n\n```js\nvar mapFiles = require('map-files');\nconsole.log(mapFiles('templates/*.txt'));\n```\n\nReturns an object of [vinyl](http://github.com/gulpjs/vinyl) files that looks something like this:\n\n```js\n{ 'test/fixtures/a.txt': <File \"test/fixtures/a.txt\" <Buffer 41 41 41>>,\n  'test/fixtures/b.txt': <File \"test/fixtures/b.txt\" <Buffer 42 42 42>>,\n  'test/fixtures/c.txt': <File \"test/fixtures/c.txt\" <Buffer 43 43 43>> }\n```\n\n## Options\n\n### options.cwd\n\nSpecify the current working directory\n\n**Params**\n\nType: `String`\n\nDefault: `process.cwd()`\n\n**Example**\n\n```js\nfiles('*.txt', {cwd: 'templates'});\n```\n\n### options.renameKey\n\nRename the key of each file object:\n\n**Params**\n\nType: `Function`\n\nDefault: `file.relative`\n\n**Example**\n\n```js\nvar files = mapFiles('templates/*.txt', {\n  renameKey: function (file) {\n    return file.basename;\n  }\n});\n```\n\nReturns something like:\n\n```js\n{ 'a.txt': <File \"test/fixtures/a.txt\" <Buffer 41 41 41>>,\n  'b.txt': <File \"test/fixtures/b.txt\" <Buffer 42 42 42>>,\n  'c.txt': <File \"test/fixtures/c.txt\" <Buffer 43 43 43>> }\n```\n\n### options.decorate\n\nPass an object of methods to decorate as getters onto each file in the results.\n\n```js\nvar yaml = require('js-yaml');\n\nvar files = mapFiles('test/fixtures/*.yml', {\n  renameKey: 'stem',\n  decorate: {\n    yaml: function(file) {\n      return yaml.safeLoad(file.contents.toString());\n    }\n  }\n});\n\nconsole.log(files.a.yaml);\n//=> {title: 'AAA'}\n```\n\n## History\n\n**v0.8.0**\n\n* `options.name` was removed, use `options.renameKey` instead.\n* `options.cache` was removed\n* `options.read` was removed\n* `options.decorate` was added. See the [decorate docs](#options.decorate).\n\n**v0.5.0**\n\nAs of v0.5.0, map-files returns absolute file paths by default. You can achieve the same results by using a custom `name` function as in the [examples](#options-name).\n\n## Related projects\n\nYou might also be interested in these projects:\n\n* [export-files](https://www.npmjs.com/package/export-files): node.js utility for exporting a directory of files as modules. | [homepage](https://github.com/jonschlinkert/export-files)\n* [file-reader](https://www.npmjs.com/package/file-reader): Read a glob of files, dynamically choosing the reader or requiring the files based on… [more](https://www.npmjs.com/package/file-reader) | [homepage](https://github.com/jonschlinkert/file-reader)\n* [filter-files](https://www.npmjs.com/package/filter-files): Recursively read directories and return a list of files, filtered to have only the files… [more](https://www.npmjs.com/package/filter-files) | [homepage](https://github.com/jonschlinkert/filter-files)\n* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/jonschlinkert/micromatch)\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/map-files/issues/new).\n\n## Building docs\n\nGenerate readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install verb && npm run docs\n```\n\nOr, if [verb](https://github.com/verbose/verb) is installed globally:\n\n```sh\n$ verb\n```\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d && npm test\n```\n\n## Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\n\nCopyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT license](https://github.com/jonschlinkert/map-files/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 23, 2016._","publish_time":1417760370074,"_cnpm_publish_time":1417760370074,"dist-tags":{"latest":"0.8.2"}}