micromatch
Advanced tools
Comparing version 2.3.9 to 2.3.10
12
index.js
@@ -70,3 +70,3 @@ /*! | ||
var negate = !!opts.negate; | ||
var negate = opts.negate || false; | ||
var orig = pattern; | ||
@@ -95,5 +95,4 @@ | ||
if (_isMatch(fp)) { | ||
res.push(fp); | ||
} | ||
if (!_isMatch(fp)) { continue; } | ||
res.push(fp); | ||
} | ||
@@ -114,3 +113,3 @@ | ||
// if `ignore` was defined, diff ignored files | ||
// if `ignore` was defined, diff ignored filed | ||
if (opts.ignore && opts.ignore.length) { | ||
@@ -315,3 +314,4 @@ pattern = opts.ignore; | ||
return function(fp) { | ||
return re.test(utils.unixify(fp, opts)); | ||
fp = utils.unixify(fp, opts); | ||
return re.test(fp); | ||
}; | ||
@@ -318,0 +318,0 @@ } |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var path = require('path'); | ||
var fileRe = require('filename-regex'); | ||
var utils = module.exports; | ||
@@ -12,16 +13,28 @@ | ||
utils.diff = require('arr-diff'); | ||
utils.unique = require('array-unique'); | ||
utils.braces = require('braces'); | ||
utils.brackets = require('expand-brackets'); | ||
utils.cache = require('regex-cache'); | ||
utils.diff = require('arr-diff'); | ||
utils.extglob = require('extglob'); | ||
utils.isExtglob = require('is-extglob'); | ||
utils.isGlob = require('is-glob'); | ||
utils.typeOf = require('kind-of'); | ||
utils.normalize = require('normalize-path'); | ||
utils.omit = require('object.omit'); | ||
utils.parseGlob = require('parse-glob'); | ||
utils.typeOf = require('kind-of'); | ||
utils.unique = require('array-unique'); | ||
utils.cache = require('regex-cache'); | ||
/** | ||
* Get the filename of a filepath | ||
* | ||
* @param {String} `string` | ||
* @return {String} | ||
*/ | ||
utils.filename = function filename(fp) { | ||
var seg = fp.match(fileRe()); | ||
return seg && seg[0]; | ||
}; | ||
/** | ||
* Returns a function that returns true if the given | ||
@@ -34,5 +47,10 @@ * pattern is the same as a given `filepath` | ||
utils.pathEquals = function(pattern, opts) { | ||
utils.isPath = function isPath(pattern, opts) { | ||
opts = opts || {}; | ||
return function(fp) { | ||
return pattern === fp; | ||
var unixified = utils.unixify(fp, opts); | ||
if(opts.nocase){ | ||
return pattern.toLowerCase() === unixified.toLowerCase(); | ||
} | ||
return pattern === unixified; | ||
}; | ||
@@ -49,5 +67,5 @@ }; | ||
utils.pathContains = function(pattern) { | ||
utils.hasPath = function hasPath(pattern, opts) { | ||
return function(fp) { | ||
return fp.indexOf(pattern) !== -1; | ||
return utils.unixify(pattern, opts).indexOf(fp) !== -1; | ||
}; | ||
@@ -64,6 +82,7 @@ }; | ||
utils.matchPath = function(pattern, opts) { | ||
return (opts && opts.contains) | ||
? utils.pathContains(pattern, opts) | ||
: utils.pathEquals(pattern, opts); | ||
utils.matchPath = function matchPath(pattern, opts) { | ||
var fn = (opts && opts.contains) | ||
? utils.hasPath(pattern, opts) | ||
: utils.isPath(pattern, opts); | ||
return fn; | ||
}; | ||
@@ -79,5 +98,5 @@ | ||
utils.hasFilename = function(re) { | ||
utils.hasFilename = function hasFilename(re) { | ||
return function(fp) { | ||
var name = path.basename(fp); | ||
var name = utils.filename(fp); | ||
return name && re.test(name); | ||
@@ -94,4 +113,6 @@ }; | ||
utils.arrayify = function(val) { | ||
return val ? (Array.isArray(val) ? val : [val]) : []; | ||
utils.arrayify = function arrayify(val) { | ||
return !Array.isArray(val) | ||
? [val] | ||
: val; | ||
}; | ||
@@ -104,3 +125,3 @@ | ||
utils.unixify = function(fp, opts) { | ||
utils.unixify = function unixify(fp, opts) { | ||
if (opts && opts.unixify === false) return fp; | ||
@@ -120,11 +141,11 @@ if (opts && opts.unixify === true || win32 || path.sep === '\\') { | ||
utils.escapePath = function(fp) { | ||
utils.escapePath = function escapePath(fp) { | ||
return fp.replace(/[\\.]/g, '\\$&'); | ||
}; | ||
utils.unescapeGlob = function(fp) { | ||
utils.unescapeGlob = function unescapeGlob(fp) { | ||
return fp.replace(/[\\"']/g, ''); | ||
}; | ||
utils.escapeRe = function(str) { | ||
utils.escapeRe = function escapeRe(str) { | ||
return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&'); | ||
@@ -131,0 +152,0 @@ }; |
{ | ||
"name": "micromatch", | ||
"description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.", | ||
"version": "2.3.9", | ||
"version": "2.3.10", | ||
"homepage": "https://github.com/jonschlinkert/micromatch", | ||
@@ -24,29 +24,30 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"arr-diff": "^3.0.0", | ||
"arr-diff": "^2.0.0", | ||
"array-unique": "^0.2.1", | ||
"braces": "^1.8.4", | ||
"expand-brackets": "^0.1.5", | ||
"extglob": "^0.3.2", | ||
"braces": "^1.8.2", | ||
"expand-brackets": "^0.1.4", | ||
"extglob": "^0.3.1", | ||
"filename-regex": "^2.0.0", | ||
"is-extglob": "^1.0.0", | ||
"is-glob": "^2.0.1", | ||
"kind-of": "^3.0.3", | ||
"kind-of": "^3.0.2", | ||
"normalize-path": "^2.0.1", | ||
"object.omit": "^2.0.0", | ||
"parse-glob": "^3.0.4", | ||
"regex-cache": "^0.4.3" | ||
"regex-cache": "^0.4.2" | ||
}, | ||
"devDependencies": { | ||
"benchmarked": "^0.2.5", | ||
"chalk": "^1.1.3", | ||
"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", | ||
"benchmarked": "^0.1.4", | ||
"chalk": "^1.1.1", | ||
"gulp": "^3.9.0", | ||
"gulp-eslint": "^1.1.1", | ||
"gulp-format-md": "^0.1.8", | ||
"gulp-istanbul": "^0.10.1", | ||
"gulp-mocha": "^2.1.3", | ||
"minimatch": "^3.0.0", | ||
"minimist": "^1.2.0", | ||
"mocha": "^2.4.5", | ||
"multimatch": "^2.1.0", | ||
"should": "^8.3.1", | ||
"write": "^0.3.1" | ||
"mocha": "^2", | ||
"multimatch": "^2.0.0", | ||
"should": "^8", | ||
"write": "^0.2.1" | ||
}, | ||
@@ -53,0 +54,0 @@ "keywords": [ |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
970
29898
13
7
1
0
+ Addedfilename-regex@^2.0.0
+ Addedarr-diff@2.0.0(transitive)
+ Addedfilename-regex@2.0.1(transitive)
- Removedarr-diff@3.0.0(transitive)
Updatedarr-diff@^2.0.0
Updatedbraces@^1.8.2
Updatedexpand-brackets@^0.1.4
Updatedextglob@^0.3.1
Updatedkind-of@^3.0.2
Updatedregex-cache@^0.4.2