{"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.8.1","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","utils.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^2.0.0","lazy-cache":"^1.0.4","matched":"^0.4.1","vinyl":"^1.1.1"},"devDependencies":{"extend-shallow":"^2.0.1","gulp-format-md":"^0.1.8","js-yaml":"^3.6.0","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":["export-files","file-reader","filter-files","micromatch"]},"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"lint":{"reflinks":true},"reflinks":["verb","vinyl"]},"gitHead":"ae6e1e1164216f216f36eea8e5cc36c6a0be1f7d","_id":"map-files@0.8.1","_shasum":"1c7b28fe62ae95fa597284df06eccb94cb7b3b93","_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":"1c7b28fe62ae95fa597284df06eccb94cb7b3b93","tarball":"http://registry-npm.ywwl.com/map-files/download/map-files-0.8.1.tgz","integrity":"sha512-ILkr956YvBaTu56r3z0gSz65EkOwp1qjTBy/pV1kt8gLCRq86wr4woXjjVLY0F0SRGpVC+ZmzXZdypg+xLmPng==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHJvYZbQByCnaVNPMKPfxppn5TtdR6saLMZ7mK1FkBMXAiEAze75mtqnt5X1w/RLQIbZBa+hB989BlAWvcy2wcdlnn8="}],"size":4084,"noattachment":false,"key":"/map-files/-/map-files-0.8.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/map-files-0.8.1.tgz_1461387531816_0.8312904092017561"},"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":1461387534243,"_cnpm_publish_time":1461387534243,"dist-tags":{"latest":"0.8.2"}}