diff --git a/index.js b/index.js index 47f4605..972316e 100644 --- a/index.js +++ b/index.js @@ -54,10 +54,7 @@ function globStream(globs, opt) { var glob = isNegatedGlob(globString); var globArray = glob.negated ? negatives : positives; - globArray.push({ - index: index, - glob: glob.pattern, - }); + globArray.push(glob.pattern); } if (positives.length === 0) { @@ -74,22 +71,9 @@ function globStream(globs, opt) { return pumpify.obj(aggregate, uniqueStream); function streamFromPositive(positive) { - var negativeGlobs = negatives - .filter(indexGreaterThan(positive.index)) - .map(toGlob) - .concat(ignore); - return new GlobStream(positive.glob, negativeGlobs, ourOpt); + var negativeGlobs = negatives.concat(ignore); + return new GlobStream(positive, negativeGlobs, ourOpt); } } -function indexGreaterThan(index) { - return function (obj) { - return obj.index > index; - }; -} - -function toGlob(obj) { - return obj.glob; -} - module.exports = globStream; diff --git a/test/index.js b/test/index.js index b51f555..4d3dad7 100644 --- a/test/index.js +++ b/test/index.js @@ -548,39 +548,15 @@ describe('glob-stream', function () { ); }); - it('respects order of negative globs', function (done) { - var expected = { - cwd: dir, - base: dir + '/fixtures/stuff', - path: dir + '/fixtures/stuff/run.dmc', - }; - + it('applies all negative globs to each positive glob', function (done) { var globs = [ './fixtures/stuff/*', '!./fixtures/stuff/*.dmc', - './fixtures/stuff/run.dmc', + './fixtures/stuff/*.dmc', ]; function assert(pathObjs) { - expect(pathObjs.length).toEqual(1); - expect(pathObjs[0]).toEqual(expected); - } - - pipe([globStream(globs, { cwd: dir }), concat(assert)], done); - }); - - it('ignores leading negative globs', function (done) { - var expected = { - cwd: dir, - base: dir + '/fixtures/stuff', - path: dir + '/fixtures/stuff/run.dmc', - }; - - var globs = ['!./fixtures/stuff/*.dmc', './fixtures/stuff/run.dmc']; - - function assert(pathObjs) { - expect(pathObjs.length).toEqual(1); - expect(pathObjs[0]).toEqual(expected); + expect(pathObjs.length).toEqual(0); } pipe([globStream(globs, { cwd: dir }), concat(assert)], done);