glob-stream
Advanced tools
Comparing version 3.1.18 to 4.0.0
35
index.js
@@ -70,13 +70,25 @@ /*jslint node: true */ | ||
var positives = globs.filter(isPositive); | ||
var negatives = globs.filter(isNegative); | ||
var positives = []; | ||
var negatives = []; | ||
globs.forEach(function(glob, index) { | ||
var globArray = isNegative(glob) ? negatives : positives; | ||
globArray.push({ | ||
index: index, | ||
glob: glob | ||
}); | ||
}); | ||
if (positives.length === 0) throw new Error("Missing positive glob"); | ||
// only one positive glob no need to aggregate | ||
if (positives.length === 1) return gs.createStream(positives[0], negatives, opt); | ||
if (positives.length === 1) { | ||
var negativeGlobs = negatives.filter(indexGreaterThan(positives[0].index)).map(toGlob); | ||
return gs.createStream(positives[0].glob, negativeGlobs, opt); | ||
} | ||
// create all individual streams | ||
var streams = positives.map(function(glob){ | ||
return gs.createStream(glob, negatives, opt); | ||
var streams = positives.map(function(positive) { | ||
var negativeGlobs = negatives.filter(indexGreaterThan(positive.index)).map(toGlob); | ||
return gs.createStream(positive.glob, negativeGlobs, opt); | ||
}); | ||
@@ -104,6 +116,2 @@ | ||
function isPositive(pattern) { | ||
return !isNegative(pattern); | ||
} | ||
function unrelative(cwd, glob) { | ||
@@ -118,3 +126,12 @@ var mod = ''; | ||
function indexGreaterThan(index) { | ||
return function(obj) { | ||
return obj.index > index; | ||
}; | ||
} | ||
function toGlob(obj) { | ||
return obj.glob; | ||
} | ||
module.exports = gs; |
{ | ||
"name": "glob-stream", | ||
"description": "File system globs as a stream", | ||
"version": "3.1.18", | ||
"version": "4.0.0", | ||
"homepage": "http://github.com/wearefractal/glob-stream", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/wearefractal/glob-stream.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
8049
108