minimatch
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -7,2 +7,3 @@ module.exports = minimatch | ||
, GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} | ||
, pathSplit = process.platform === "win32" ? /\\|\// : "/" | ||
@@ -146,2 +147,18 @@ var path = require("path") | ||
if (options.debug) console.error(this.pattern, set) | ||
// glob --> regexps | ||
set = set.map(function (s, si, set) { | ||
return s.map(this.parse, this) | ||
}, this) | ||
if (options.debug) console.error(this.pattern, set) | ||
// filter out everything that didn't compile properly. | ||
set = set.filter(function (s) { | ||
return -1 === s.indexOf(false) | ||
}) | ||
if (options.debug) console.error(this.pattern, set) | ||
// step 4: if we have a defined root, then patterns starting with "" | ||
@@ -164,6 +181,10 @@ // get attached to that. If we have a defined cwd, then patterns | ||
if (options.root && p[0] === "") { | ||
return options.root.split("/").concat(p) | ||
var r = options.root.split(pathSplit) | ||
if (r[r.length - 1] === "") r.pop() | ||
r = r.concat(p.slice(1)) | ||
r.absolute = true | ||
return r | ||
} | ||
if (options.cwd && p[0] !== "") { | ||
return options.cwd.split("/").concat(p) | ||
return options.cwd.split(pathSplit).concat(p) | ||
} | ||
@@ -174,18 +195,2 @@ return p | ||
if (options.debug) console.error(this.pattern, set) | ||
// glob --> regexps | ||
set = set.map(function (s, si, set) { | ||
return s.map(this.parse, this) | ||
}, this) | ||
if (options.debug) console.error(this.pattern, set) | ||
// filter out everything that didn't compile properly. | ||
set = set.filter(function (s) { | ||
return -1 === s.indexOf(false) | ||
}) | ||
if (options.debug) console.error(this.pattern, set) | ||
this.set = set | ||
@@ -792,2 +797,4 @@ } | ||
if (f === "/" && partial) return true | ||
var options = this.options | ||
@@ -797,6 +804,3 @@ | ||
// f = path.normalize(f) | ||
var absolute = isAbsolute(f) | ||
// console.error(this.pattern, f, absolute) | ||
// windows: need to use /, not \ | ||
@@ -810,3 +814,5 @@ // On other platforms, \ is a valid (albeit bad) filename char. | ||
f = f.split(slashSplit) | ||
// console.error(this.pattern, "split", f) | ||
if (options.debug) { | ||
console.error(this.pattern, "split", f) | ||
} | ||
@@ -1012,17 +1018,1 @@ // just ONE of the pattern sets in this.set needs to match | ||
} | ||
function isAbsolute (p) { | ||
if (process.platform !== "win32") return p.charAt(0) === "/" | ||
// yanked from node/lib/path.js | ||
var splitDeviceRe = | ||
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?([\\\/])?([\s\S]*?)$/ | ||
var result = p.match(splitDeviceRe) | ||
, device = result[1] || "" | ||
, isUnc = device && device.charAt(1) !== ":" | ||
, isAbs = !!result[2] || isUnc // UNC always absolute | ||
return isAbs | ||
} |
@@ -5,3 +5,3 @@ { | ||
"description": "a glob matcher in javascript", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45923
1129