@@ -19,6 +19,7 @@ function globStream(globs, opt) {
19
19
}
20
20
21
21
var ourOpt = extend ( { } , opt ) ;
22
+ var ignore = ourOpt . ignore ;
22
23
23
24
if ( typeof ourOpt . cwd !== 'string' ) {
24
25
ourOpt . cwd = process . cwd ( ) ;
@@ -38,6 +39,14 @@ function globStream(globs, opt) {
38
39
if ( ourOpt . cwdbase ) {
39
40
ourOpt . base = ourOpt . cwd ;
40
41
}
42
+ // Normalize string `ignore` to array
43
+ if ( typeof ignore === 'string' ) {
44
+ ignore = [ ignore ] ;
45
+ }
46
+ // Ensure `ignore` is an array
47
+ if ( ! Array . isArray ( ignore ) ) {
48
+ ignore = [ ] ;
49
+ }
41
50
42
51
// Only one glob no need to aggregate
43
52
if ( ! Array . isArray ( globs ) ) {
@@ -80,8 +89,10 @@ function globStream(globs, opt) {
80
89
return pumpify . obj ( aggregate , uniqueStream ) ;
81
90
82
91
function streamFromPositive ( positive ) {
83
- var negativeGlobs = negatives . filter ( indexGreaterThan ( positive . index ) )
84
- . map ( toGlob ) ;
92
+ var negativeGlobs = negatives
93
+ . filter ( indexGreaterThan ( positive . index ) )
94
+ . map ( toGlob )
95
+ . concat ( ignore ) ;
85
96
return createStream ( positive . glob , negativeGlobs , ourOpt ) ;
86
97
}
87
98
}
@@ -94,9 +105,6 @@ function createStream(ourGlob, negatives, opt) {
94
105
var ourOpt = extend ( { } , opt ) ;
95
106
delete ourOpt . root ;
96
107
97
- if ( Array . isArray ( opt . ignore ) ) {
98
- negatives = opt . ignore . concat ( negatives ) ;
99
- }
100
108
var ourNegatives = negatives . map ( resolveNegatives ) ;
101
109
ourOpt . ignore = ourNegatives ;
102
110
0 commit comments