motion
Version:
motion - moving development forward
73 lines (72 loc) • 6.17 kB
JSON
{
"_args": [
[
"gulp-match@https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.0.tgz",
"/Users/nw/flint/packages/flint"
]
],
"_from": "gulp-match@>=1.0.0 <2.0.0",
"_id": "gulp-match@1.0.0",
"_inCache": true,
"_location": "/gulp-match",
"_phantomChildren": {
"brace-expansion": "1.1.2"
},
"_requested": {
"name": "gulp-match",
"raw": "gulp-match@https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.0.tgz",
"rawSpec": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.0.tgz",
"scope": null,
"spec": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.0.tgz",
"type": "remote"
},
"_requiredBy": [
"/gulp-if",
"/gulp-ignore"
],
"_resolved": "https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.0.tgz",
"_shasum": "ae7617003387d753468de8418ae402071f3931fb",
"_shrinkwrap": null,
"_spec": "gulp-match@https://registry.npmjs.org/gulp-match/-/gulp-match-1.0.0.tgz",
"_where": "/Users/nw/flint/packages/flint",
"author": {
"name": "Rob Richardson",
"url": "http://robrich.org/"
},
"bugs": {
"url": "https://github.com/robrich/gulp-match/issues"
},
"dependencies": {
"minimatch": "^3.0.0"
},
"description": "Does a vinyl file match a condition?",
"devDependencies": {
"jshint": "^2.8.0",
"mocha": "^2.3.3",
"should": "^7.1.0"
},
"engines": {
"node": ">= 0.10.0"
},
"homepage": "https://github.com/robrich/gulp-match",
"keywords": [
"conditional",
"gulpfriendly",
"if",
"minimatch"
],
"license": "MIT",
"main": "./index.js",
"name": "gulp-match",
"optionalDependencies": {},
"readme": "gulp-match \r\n==========\r\n\r\nDoes a vinyl file match a condition? This function checks the condition on the `file.path` of the\r\n[vinyl-fs](https://github.com/wearefractal/vinyl-fs) file passed to it.\r\n\r\nCondition can be a boolean, a function, a regular expression, a glob string (or array of glob strings), or a stat filter object\r\n\r\nUsed by [gulp-if](https://github.com/robrich/gulp-if) and [gulp-ignore](https://github.com/robrich/gulp-ignore)\r\n\r\n## Usage\r\n\r\n```javascript\r\nvar gulpmatch = require('gulp-match');\r\nvar map = require('map-stream');\r\n\r\nvar condition = true; // TODO: add business logic here\r\nvar options = null; // Optionally pass options to minimatch\r\n\r\nvinylfs.src('path/to/file.js')\r\n .pipe(map(function (file, cb) {\r\n var match = gulpmatch(file, condition, options);\r\n if (match) {\r\n // it matched, do stuff\r\n }\r\n cb(null, file);\r\n }));\r\n```\r\n\r\n## API\r\n\r\n### file\r\n\r\nA [vinyl-fs](https://github.com/wearefractal/vinyl-fs) file.\r\n\r\n### condition\r\n\r\n#### boolean condition\r\n\r\n```javascript\r\nvar match = gulpmatch(file, true);\r\n```\r\n\r\nif the condition parameter is `true` or `false`, results will also be `true` or `false`.\r\n\r\n#### function condition\r\n\r\n```javascript\r\nvar match = gulpmatch(file, function (file) {\r\n return true;\r\n})\r\n```\r\n\r\nif the condition parameter is a function, it will be called, passing in `file` passed to gulp-match.\r\n\r\n#### regular expression condition\r\n\r\n```javascript\r\nvar match = gulpmatch(file, /some\\/path\\.js/);\r\n```\r\n\r\nIf the condition is a regular expression, it will be evaluated on the `file.path` passed to gulp-match.\r\n\r\n#### glob condition\r\n\r\n```javascript\r\nvar match = gulpmatch(file, './some/path.js');\r\n```\r\n```javascript\r\nvar match = gulpmatch(file, ['./array','!./of','./globs.js']);\r\n```\r\n\r\nThe globs are passed to [minimatch](https://github.com/isaacs/minimatch). If the glob matches (or any of the elements in the array match), gulp-match returns `true` else `false`.\r\n\r\n#### stat filter condition\r\n\r\n```javascript\r\nvar match = gulpmatch(file, {isFile:true});\r\n```\r\n```javascript\r\nvar match = gulpmatch(file, {isDirectory:false});\r\n```\r\n\r\nIf the condition is an object with a `isFile` or `isDirectory` property, it'll match the details on the\r\n[vinyl-fs](https://github.com/wearefractal/vinyl-fs) file's [`stat`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object.\r\n\r\n#### else\r\n\r\n```javascript\r\nvar match = gulpmatch(file, 42);\r\n// match = true\r\n```\r\n```javascript\r\nvar match = gulpmatch(file, '');\r\n// match = false\r\n```\r\n\r\nIf there's no matching rule from the rules above, it'll return `true` for truthy conditions, `false` for falsey conditions (including `undefined`).\r\n\r\n### options\r\n\r\n#### minimatch options object\r\n\r\nSee [https://github.com/isaacs/minimatch](minimatch) for options docs.\r\n\r\n\r\nLICENSE\r\n-------\r\n\r\n(MIT License)\r\n\r\nCopyright (c) 2014 [Richardson & Sons, LLC](http://richardsonandsons.com/)\r\n\r\nPermission is hereby granted, free of charge, to any person obtaining\r\na copy of this software and associated documentation files (the\r\n\"Software\"), to deal in the Software without restriction, including\r\nwithout limitation the rights to use, copy, modify, merge, publish,\r\ndistribute, sublicense, and/or sell copies of the Software, and to\r\npermit persons to whom the Software is furnished to do so, subject to\r\nthe following conditions:\r\n\r\nThe above copyright notice and this permission notice shall be\r\nincluded in all copies or substantial portions of the Software.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\r\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n",
"readmeFilename": "README.md",
"repository": {
"type": "git",
"url": "git://github.com/robrich/gulp-match.git"
},
"scripts": {
"test": "mocha && jshint ."
},
"version": "1.0.0"
}