File tree Expand file tree Collapse file tree 3 files changed +23
-8
lines changed
Expand file tree Collapse file tree 3 files changed +23
-8
lines changed Original file line number Diff line number Diff line change 11var es = require ( 'event-stream' ) ;
2+ var Combine = require ( 'stream-combiner' ) ;
23var glob = require ( 'glob' ) ;
34var minimatch = require ( 'minimatch' ) ;
45var path = require ( 'path' ) ;
@@ -67,9 +68,7 @@ module.exports = us = {
6768
6869 // stream to check against negatives
6970 var filterStream = es . map ( function ( filename , cb ) {
70- var matcha = function ( pattern ) {
71- return isMatch ( filename , pattern ) ;
72- } ;
71+ var matcha = isMatch . bind ( null , filename ) ;
7372 if ( ! negatives . every ( matcha ) ) return cb ( null , filename ) ; // pass
7473 cb ( ) ; // ignore
7574 } ) ;
@@ -96,10 +95,7 @@ module.exports = us = {
9695 } ) ;
9796
9897 // then just pipe them to a single stream and return it
99- var aggregate = es . pause ( ) ;
100- streams . forEach ( function ( gStream ) {
101- gStream . pipe ( aggregate ) ;
102- } ) ;
98+ var aggregate = Combine . apply ( null , streams ) ;
10399 return aggregate ;
104100 }
105101} ;
Original file line number Diff line number Diff line change 99 "dependencies" : {
1010 "glob" : " ~3.2.7" ,
1111 "event-stream" : " ~3.0.18" ,
12- "minimatch" : " ~0.2.12"
12+ "minimatch" : " ~0.2.12" ,
13+ "stream-combiner" : " 0.0.2"
1314 },
1415 "devDependencies" : {
1516 "mocha" : " *" ,
Original file line number Diff line number Diff line change @@ -91,5 +91,23 @@ describe('glob-stream', function() {
9191 } ) ;
9292 } ) ;
9393
94+ it ( 'should return a file name stream from two globs and a negative' , function ( done ) {
95+ var stream = gs . create ( [ "./fixtures/*.coffee" , "./fixtures/whatsgoingon/*.coffee" ] , { cwd : __dirname } ) ;
96+ should . exist ( stream ) ;
97+ stream . on ( 'error' , function ( err ) {
98+ throw err ;
99+ } ) ;
100+ stream . on ( 'data' , function ( file ) {
101+ should . exist ( file ) ;
102+ should . exist ( file . path ) ;
103+ should . exist ( file . base ) ;
104+ should . exist ( file . cwd ) ;
105+ String ( file . cwd ) . should . equal ( __dirname ) ;
106+ String ( file . base ) . should . equal ( "fixtures/" ) ;
107+ String ( file . path ) . should . equal ( join ( __dirname , "./fixtures/test.coffee" ) ) ;
108+ done ( ) ;
109+ } ) ;
110+ } ) ;
111+
94112 } ) ;
95113} ) ;
You can’t perform that action at this time.
0 commit comments