@@ -71,7 +71,7 @@ class DirectoryWatcher extends EventEmitter {
7171 this . directories = new Map ( ) ;
7272 this . lastWatchEvent = 0 ;
7373 this . initialScan = true ;
74- this . ignored = options . ignored ;
74+ this . ignored = options . ignored || ( ( ) => false ) ;
7575 this . nestedWatching = false ;
7676 this . polledWatching =
7777 typeof options . poll === "number"
@@ -96,12 +96,6 @@ class DirectoryWatcher extends EventEmitter {
9696 this . doScan ( true ) ;
9797 }
9898
99- checkIgnore ( path ) {
100- if ( ! this . ignored ) return false ;
101- path = path . replace ( / \\ / g, "/" ) ;
102- return this . ignored . test ( path ) ;
103- }
104-
10599 createWatcher ( ) {
106100 try {
107101 if ( this . polledWatching ) {
@@ -178,7 +172,7 @@ class DirectoryWatcher extends EventEmitter {
178172 setFileTime ( filePath , mtime , initial , ignoreWhenEqual , type ) {
179173 const now = Date . now ( ) ;
180174
181- if ( this . checkIgnore ( filePath ) ) return ;
175+ if ( this . ignored ( filePath ) ) return ;
182176
183177 const old = this . files . get ( filePath ) ;
184178
@@ -237,7 +231,7 @@ class DirectoryWatcher extends EventEmitter {
237231 }
238232
239233 setDirectory ( directoryPath , birthtime , initial , type ) {
240- if ( this . checkIgnore ( directoryPath ) ) return ;
234+ if ( this . ignored ( directoryPath ) ) return ;
241235 if ( directoryPath === this . path ) {
242236 if ( ! initial ) {
243237 this . forEachWatcher ( this . path , w =>
@@ -398,7 +392,7 @@ class DirectoryWatcher extends EventEmitter {
398392 }
399393
400394 const filePath = path . join ( this . path , filename ) ;
401- if ( this . checkIgnore ( filePath ) ) return ;
395+ if ( this . ignored ( filePath ) ) return ;
402396
403397 if ( this . _activeEvents . get ( filename ) === undefined ) {
404398 this . _activeEvents . set ( filename , false ) ;
0 commit comments