{"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.6.2","homepage":"https://github.com/jonschlinkert/map-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"https://github.com/jonschlinkert/map-files"},"bugs":{"url":"https://github.com/jonschlinkert/map-files/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"globby":"^1.1.0"},"devDependencies":{"extend-shallow":"^1.1.1","gray-matter":"^1.0.1","mocha":"*","relative":"^2.0.0","should":"^5.0.0"},"keywords":["dir","directories","directory","dirs","file","filepath","filepaths","files","hash","list","map","mapping","name","object","path","paths"],"gitHead":"c09354281a23c2f9cbf75c4e12f6cfd829b980a0","_id":"map-files@0.6.2","_shasum":"460b502cdb2d4b1f66e2aae84a8144c43130fd38","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"460b502cdb2d4b1f66e2aae84a8144c43130fd38","tarball":"http://registry-npm.ywwl.com/map-files/download/map-files-0.6.2.tgz","integrity":"sha512-CDoQVbK/wmpy7PzKqvceD2aRzHsqzJnyPVJpeS8r2Me6ULVb3888la3qsrAVw2vr3Xu/NkAFzXJejerBlSBPqw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDYHc3TpAZTS2QV3znlerGBByvxtf0fPe6TsdiFYM/EGAiEA4OaHCd31T7p2nNLyK31fHh4wS8lOOxJ9t99t8+WyIAM="}],"size":3138,"noattachment":false,"key":"/map-files/-/map-files-0.6.2.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":1425200190987,"_cnpm_publish_time":1425200190987,"dist-tags":{"latest":"0.8.2"}}