{"_id":"match-file","_rev":"75243","name":"match-file","description":"Returns true when the given `name` matches any of the path properties on a vinyl file.","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"time":{"modified":"2021-06-03T10:24:25.000Z","created":"2016-01-21T10:08:54.040Z","1.0.0":"2018-02-14T11:52:47.073Z","0.2.2":"2017-02-24T11:08:10.451Z","0.2.1":"2017-02-01T15:53:16.103Z","0.2.0":"2016-04-26T23:09:58.380Z","0.1.0":"2016-01-21T10:08:54.040Z"},"users":{},"author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/match-file.git"},"versions":{"1.0.0":{"name":"match-file","description":"Returns true when the given `name` matches any of the path properties on a vinyl file.","version":"1.0.0","homepage":"https://github.com/jonschlinkert/match-file","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/match-file.git"},"bugs":{"url":"https://github.com/jonschlinkert/match-file/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"is-glob":"^4.0.0","micromatch":"^3.1.5","path-ends-with":"^1.1.0"},"devDependencies":{"gulp-format-md":"^1.0.0","mocha":"^3.5.3","vinyl":"^2.1.0"},"keywords":["assemble","collection","file","find","gulpfriendly","match","view","vinyl"],"verb":{"plugins":["gulp-format-md"],"related":{"list":["assemble","generate","get-view","micromatch","verb"]},"toc":false,"layout":"default","tasks":["readme"],"lint":{"reflinks":true},"reflinks":["gulp","micromatch","verb"]},"gitHead":"a19f2d25adbfae22fe6e663daf5136e626715cc3","_id":"match-file@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"dist":{"shasum":"3496169751607b22f91a0153f879ce6deae9a968","size":4157,"noattachment":false,"key":"/match-file/-/match-file-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/match-file/download/match-file-1.0.0.tgz"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/match-file_1.0.0_1518609166390_0.5979959150081418"},"_hasShrinkwrap":false,"publish_time":1518609167073,"_cnpm_publish_time":1518609167073},"0.2.2":{"name":"match-file","description":"Returns true when the given `name` matches any of the path properties on a vinyl file.","version":"0.2.2","homepage":"https://github.com/jonschlinkert/match-file","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/match-file.git"},"bugs":{"url":"https://github.com/jonschlinkert/match-file/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"is-glob":"^3.1.0","isobject":"^3.0.0","micromatch":"^2.3.11"},"devDependencies":{"gulp":"^3.9.1","gulp-format-md":"^0.1.11","lazy-cache":"^2.0.2","mocha":"^3.2.0","vinyl":"^2.0.1"},"keywords":["assemble","collection","file","find","gulpfriendly","match","view","vinyl"],"verb":{"plugins":["gulp-format-md"],"related":{"list":["assemble","generate","get-view","micromatch","verb"]},"toc":false,"layout":"default","tasks":["readme"],"lint":{"reflinks":true},"reflinks":["gulp","micromatch","verb"]},"gitHead":"415694a8719b50d76e987c1d493f1069bf4c0efa","_id":"match-file@0.2.2","_shasum":"26e6bcf1b390a661f6126faf8ac501e33eccfae9","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"26e6bcf1b390a661f6126faf8ac501e33eccfae9","size":4102,"noattachment":false,"key":"/match-file/-/match-file-0.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/match-file/download/match-file-0.2.2.tgz"},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/match-file-0.2.2.tgz_1487934489727_0.27748965681530535"},"directories":{},"publish_time":1487934490451,"_cnpm_publish_time":1487934490451,"_hasShrinkwrap":false},"0.2.1":{"name":"match-file","description":"Returns true when the given `name` matches any of the path properties on a vinyl file.","version":"0.2.1","homepage":"https://github.com/jonschlinkert/match-file","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/match-file.git"},"bugs":{"url":"https://github.com/jonschlinkert/match-file/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"isobject":"^3.0.0","micromatch":"^2.3.11","parse-filepath":"^1.0.1"},"devDependencies":{"gulp":"^3.9.1","gulp-format-md":"^0.1.11","lazy-cache":"^2.0.2","mocha":"^3.2.0","vinyl":"^2.0.1"},"keywords":["assemble","collection","file","find","gulpfriendly","match","view","vinyl"],"verb":{"plugins":["gulp-format-md"],"related":{"list":["assemble","generate","get-view","micromatch","verb"]},"toc":false,"layout":"default","tasks":["readme"],"lint":{"reflinks":true},"reflinks":["gulp","micromatch","verb"]},"gitHead":"fc428906c40f5ae91586e76b65cfb3739ac227e5","_id":"match-file@0.2.1","_shasum":"1acfb3741ca025f2a4bb08909b7eaf8e3f281e3a","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"1acfb3741ca025f2a4bb08909b7eaf8e3f281e3a","size":4054,"noattachment":false,"key":"/match-file/-/match-file-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/match-file/download/match-file-0.2.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/match-file-0.2.1.tgz_1485964394231_0.03712095320224762"},"directories":{},"publish_time":1485964396103,"_cnpm_publish_time":1485964396103,"_hasShrinkwrap":false},"0.2.0":{"name":"match-file","description":"Returns true when the given `name` matches any of the path properties on a vinyl file.","version":"0.2.0","homepage":"https://github.com/jonschlinkert/match-file","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/match-file.git"},"bugs":{"url":"https://github.com/jonschlinkert/match-file/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"micromatch":"^2.3.8"},"devDependencies":{"gulp":"^3.9.1","gulp-eslint":"^2.0.0","gulp-format-md":"^0.1.9","gulp-istanbul":"^0.10.4","gulp-mocha":"^2.2.0","lazy-cache":"^1.0.4","mocha":"^2.4.5","through2":"^2.0.1","vinyl":"^1.1.1"},"keywords":["assemble","collection","file","find","gulpfriendly","match","view","vinyl"],"verb":{"plugins":["gulp-format-md"],"related":{"list":["assemble","generate","get-view","micromatch","verb"]},"toc":false,"layout":"default","tasks":["readme"],"lint":{"reflinks":true},"reflinks":["micromatch","gulp","verb"]},"gitHead":"f64c79b8e11f861c5a133971081a73671cf4d73b","_id":"match-file@0.2.0","_shasum":"898bedd05fffc81edc571627eb3c19d1f5cf175b","_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":"898bedd05fffc81edc571627eb3c19d1f5cf175b","size":3637,"noattachment":false,"key":"/match-file/-/match-file-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/match-file/download/match-file-0.2.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/match-file-0.2.0.tgz_1461712197421_0.39196785306558013"},"directories":{},"publish_time":1461712198380,"_cnpm_publish_time":1461712198380,"_hasShrinkwrap":false},"0.1.0":{"name":"match-file","description":"Returns true when the given `name` matches any of the path properties on a vinyl file","version":"0.1.0","homepage":"https://github.com/jonschlinkert/match-file","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/match-file.git"},"bugs":{"url":"https://github.com/jonschlinkert/match-file/issues"},"license":"MIT","files":["index.js"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{},"devDependencies":{"gulp-format-md":"^0.1.5","mocha":"^2.3.4","vinyl":"^1.1.1"},"keywords":["assemble","collection","file","find","gulpfriendly","match","view","vinyl"],"verb":{"layout":"default","plugins":["gulp-format-md"],"related":{"list":["assemble","verb","templates","gulp","vinyl"]}},"_id":"match-file@0.1.0","_shasum":"7416b5c461a552d0910e9eb8f3b4c96affa4526e","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.3.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"7416b5c461a552d0910e9eb8f3b4c96affa4526e","size":2513,"noattachment":false,"key":"/match-file/-/match-file-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/match-file/download/match-file-0.1.0.tgz"},"directories":{},"publish_time":1453370934040,"_cnpm_publish_time":1453370934040,"_hasShrinkwrap":false}},"readme":"# match-file [![NPM version](https://img.shields.io/npm/v/match-file.svg?style=flat)](https://www.npmjs.com/package/match-file) [![NPM monthly downloads](https://img.shields.io/npm/dm/match-file.svg?style=flat)](https://npmjs.org/package/match-file) [![NPM total downloads](https://img.shields.io/npm/dt/match-file.svg?style=flat)](https://npmjs.org/package/match-file) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/match-file.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/match-file)\n\n> Returns true when the given `name` matches any of the path properties on a vinyl file.\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save match-file\n```\n\n## Usage\n\n```js\nvar matchFile = require('match-file');\n```\n\n## API\n\n### matchFile\n\nReturns true if the given string matches one of the path properties on the `file` object (does not match agains `file.extname` only)\n\n```js\nvar File = require('vinyl');\nvar matchFile = require('match-file');\n\nvar file = new File({path: 'a/b/c.txt', base: 'a'});\nvar isMatch = matchFile('c.txt', file);\n//=> true (since `c.txt` matches file.basename)\n```\n\n**Examples**\n\nContinuing with the above setup code, all of the following would return `true`:\n\n```js\n// file.path\nmatchFile('a/b/c.txt', file);\n// file.relative\nmatchFile('b/c.txt', file);\n// file.basename\nmatchFile('c.txt', file);\n// file.stem\nmatchFile('c', file);\n```\n\n### .isMatch\n\nSimilar to `matchFile`, but **also supports glob patterns** for matching. [micromatch](https://github.com/micromatch/micromatch) is used for matching, visit that project to see all available features and options.\n\n```js\nvar file = new File({path: 'a/b/c.txt'});\nconsole.log(matcher.isMatch('*.js', file));\n//=> false\n\nvar file = new File({path: 'a/b/c.js'});\nconsole.log(matcher.isMatch('*.js', file));\n//=> true\n```\n\n#### Examples\n\n```js\nvar File = require('vinyl');\nvar matchFile = require('match-file');\n\nvar file = new File({path: 'a/b/c/d/e.txt', base: 'a/b/c'});\nfile.key = 'zzz/a.txt'; // arbitrary key (for caching)\n```\n\n```js\n// file.path\nconsole.log(matchFile.isMatch('a/b/c/d/e.txt', file));\n// file.relative\nconsole.log(matchFile.isMatch('d/e.txt', file));\n// file.basename\nconsole.log(matchFile.isMatch('e.txt', file));\n// file.stem\nconsole.log(matchFile.isMatch('e', file));\n// file.key\nconsole.log(matchFile.isMatch('zzz/a.txt', file));\n// glob pattern for `file.path`\nconsole.log(matchFile.isMatch('**/*.txt', file));\n// glob pattern for `file.relative`\nconsole.log(matchFile.isMatch('d/*.txt', file));\n// glob pattern for `file.stem`\nconsole.log(matchFile.isMatch('*', file));\n// glob pattern for `file.basename`\nconsole.log(matchFile.isMatch('*.txt', file));\n```\n\n### .matcher\n\nReturns a matcher function bound to the given glob `patterns` and `options`. [micromatch](https://github.com/micromatch/micromatch) is used for matching, visit that project to see all available features and options.\n\n```js\nvar isMatch = matchFile.matcher('*.js');\nconsole.log(isMatch);\n//=> [function]\n\nvar file = new File({path: 'a/b/c.txt'});\nconsole.log(isMatch(file));\n//=> false\n\nvar file = new File({path: 'a/b/c.js'});\nconsole.log(isMatch(file));\n//=> true\n```\n\n#### Examples\n\nGiven this setup code:\n\n```js\nvar File = require('vinyl');\nvar matchFile = require('match-file');\n\nvar file = new File({path: 'a/b/c/d/e.txt', base: 'a/b/c'});\nfile.key = 'zzz/a.txt'; // arbitrary key (for caching)\n```\n\nAll of the following examples would return `true`:\n\n```js\n// file.path\nvar isMatch = matchFile.matcher('a/b/c/d/e.txt');\nconsole.log(isMatch(file));\n// file.relative\nvar isMatch = matchFile.matcher('d/e.txt');\nconsole.log(isMatch(file));\n// file.basename\nvar isMatch = matchFile.matcher('e.txt');\nconsole.log(isMatch(file));\n// file.stem\nvar isMatch = matchFile.matcher('e');\nconsole.log(isMatch(file));\n// file.key\nvar isMatch = matchFile.matcher('zzz/a.txt');\nconsole.log(isMatch(file));\n// glob pattern for `file.path`\nvar isMatch = matchFile.matcher('**/*.txt');\nconsole.log(isMatch(file));\n// glob pattern for `file.relative`\nvar isMatch = matchFile.matcher('d/*.txt');\nconsole.log(isMatch(file));\n// glob pattern for `file.stem`\nvar isMatch = matchFile.matcher('*');\nconsole.log(isMatch(file));\n// glob pattern for `file.basename`\nvar isMatch = matchFile.matcher('*.txt');\nconsole.log(isMatch(file));\n```\n\n## Gulp usage\n\nUse in your [gulp](http://gulpjs.com) plugin:\n\n```js\nvar though = require('though2');\nvar gulp = require('gulp');\n\ngulp.task('example', function() {\n  return gulp.src('src/**/*')\n    .pipe(filter('*.js'));\n});\n\nfunction filter(pattern, options) {\n  // define a matcher function outside of the plugin function\n  var isMatch = matchFile.matcher(pattern, options);\n\n  return through.obj(function(file, enc, next) {\n    // use the matcher function\n    if (isMatch(file)) {\n      next(null, file);\n      return;\n    }\n    next();\n  });\n}\n```\n\n## About\n\n<details>\n<summary><strong>Contributing</strong></summary>\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n</details>\n\n<details>\n<summary><strong>Running Tests</strong></summary>\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install && npm test\n```\n\n</details>\n\n<details>\n<summary><strong>Building docs</strong></summary>\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n</details>\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble \"Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit\")\n* [generate](https://www.npmjs.com/package/generate): Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the… [more](https://github.com/generate/generate) | [homepage](https://github.com/generate/generate \"Command line tool and developer framework for scaffolding out new GitHub projects. Generate offers the robustness and configurability of Yeoman, the expressiveness and simplicity of Slush, and more powerful flow control and composability than either.\")\n* [get-view](https://www.npmjs.com/package/get-view): Utility for getting an assemble view from a collection object. | [homepage](https://github.com/jonschlinkert/get-view \"Utility for getting an assemble view from a collection object.\")\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/micromatch/micromatch \"Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.\")\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://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb \"Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.\")\n\n### Author\n\n**Jon Schlinkert**\n\n* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 14, 2018._","_attachments":{},"homepage":"https://github.com/jonschlinkert/match-file","bugs":{"url":"https://github.com/jonschlinkert/match-file/issues"},"license":"MIT"}