{"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.7.6","homepage":"https://github.com/jonschlinkert/map-files","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/map-files.git"},"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":{"lazy-cache":"^1.0.4","matched":"^0.4.1","micromatch":"^2.3.8"},"devDependencies":{"extend-shallow":"^2.0.1","gray-matter":"^2.0.2","mocha":"^2.4.5","relative":"^3.0.2","should":"^8.3.1"},"keywords":["dir","directories","directory","dirs","file","filepath","filepaths","files","hash","list","map","mapping","name","object","path","paths"],"verb":{"related":{"list":["file-reader","filter-files","micromatch","export-files"]}},"gitHead":"36a1ab677c82219a2f994eb0393b43e1771b9459","_id":"map-files@0.7.6","_shasum":"8c4b9935a23aab0755eb0598a664796f23babd54","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"8c4b9935a23aab0755eb0598a664796f23babd54","tarball":"http://registry-npm.ywwl.com/map-files/download/map-files-0.7.6.tgz","integrity":"sha512-V9koclI0R5J0oSlW4MLn1B+s51yKDEir9fEW5+yo7hlspuP3YNnQ4pQ+uuhjtkUZ83sqBKgU6xknQ3nfx4Wc7A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICTEfyHxczk9RAe1Vvwv9oJYru2B4n3egK1hVzFLAqwYAiAVs/v8Ec7r7FMbvY1MVJFwetY7i+ubv98Ln6qCI0WxAw=="}],"size":3749,"noattachment":false,"key":"/map-files/-/map-files-0.7.6.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/map-files-0.7.6.tgz_1461386536736_0.472916011698544"},"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":1461386538627,"_cnpm_publish_time":1461386538627,"dist-tags":{"latest":"0.8.2"}}