gulp-match
Advanced tools
Comparing version 0.2.1 to 1.0.0
10
index.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
module.exports = function (file, condition) { | ||
module.exports = function (file, condition, options) { | ||
if (!file) { | ||
@@ -26,3 +26,3 @@ throw new Error('gulp-match: vinyl file required'); | ||
// FRAGILE: ASSUME: it's a regex | ||
return condition.test(file.path); | ||
return condition.test(file.relative); | ||
} | ||
@@ -32,3 +32,3 @@ | ||
// FRAGILE: ASSUME: it's a minimatch expression | ||
return minimatch(file.path, condition); | ||
return minimatch(file.relative, condition, options); | ||
} | ||
@@ -45,6 +45,6 @@ | ||
if (step[0] === '!') { | ||
if (minimatch(file.path, step.slice(1))) { | ||
if (minimatch(file.relative, step.slice(1), options)) { | ||
return false; | ||
} | ||
} else if (minimatch(file.path, step)) { | ||
} else if (minimatch(file.relative, step, options)) { | ||
ret = true; | ||
@@ -51,0 +51,0 @@ } |
{ | ||
"name": "gulp-match", | ||
"description": "Does a vinyl file match a condition?", | ||
"version": "0.2.1", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/robrich/gulp-match", | ||
@@ -16,11 +16,11 @@ "repository": "git://github.com/robrich/gulp-match.git", | ||
"dependencies": { | ||
"minimatch": "^1.0.0" | ||
"minimatch": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"jshint": "^2.5.2", | ||
"mocha": "^1.20.1", | ||
"should": "^4.0.4" | ||
"jshint": "^2.8.0", | ||
"mocha": "^2.3.3", | ||
"should": "^7.1.0" | ||
}, | ||
"scripts": { | ||
"test": "mocha && jshint ./index.js ./test/." | ||
"test": "mocha && jshint ." | ||
}, | ||
@@ -30,8 +30,3 @@ "engines": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://github.com/robrich/gulp-match/raw/master/LICENSE" | ||
} | ||
] | ||
"license": "MIT" | ||
} |
gulp-match  | ||
========== | ||
Does a vinyl file match a condition? This function checks the condition on the `file.path` of the | ||
Does a vinyl file match a condition? This function checks the condition on the `file.path` of the | ||
[vinyl-fs](https://github.com/wearefractal/vinyl-fs) file passed to it. | ||
@@ -18,6 +18,7 @@ | ||
var condition = true; // TODO: add business logic here | ||
var options = null; // Optionally pass options to minimatch | ||
vinylfs.src('path/to/file.js') | ||
.pipe(map(function (file, cb) { | ||
var match = gulpmatch(file, condition); | ||
var match = gulpmatch(file, condition, options); | ||
if (match) { | ||
@@ -84,3 +85,3 @@ // it matched, do stuff | ||
If the condition is an object with a `isFile` or `isDirectory` property, it'll match the details on the | ||
If the condition is an object with a `isFile` or `isDirectory` property, it'll match the details on the | ||
[vinyl-fs](https://github.com/wearefractal/vinyl-fs) file's [`stat`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object. | ||
@@ -101,3 +102,9 @@ | ||
### options | ||
#### minimatch options object | ||
See [https://github.com/isaacs/minimatch](minimatch) for options docs. | ||
LICENSE | ||
@@ -104,0 +111,0 @@ ------- |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8317
9
0
132
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedminimatch@3.1.2(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@1.0.0(transitive)
- Removedsigmund@1.0.1(transitive)
Updatedminimatch@^3.0.0