@@ -13,10 +13,10 @@ for await (const entry of readdirp('.')) {
13
13
```
14
14
*/
15
15
/*! readdirp - MIT License (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com) */
16
- import type { Stats , Dirent } from 'node:fs' ;
17
- import { stat , lstat , readdir , realpath } from 'node:fs/promises' ;
16
+ import type { Dirent , Stats } from 'node:fs' ;
17
+ import { lstat , readdir , realpath , stat } from 'node:fs/promises' ;
18
+ import { join as pjoin , relative as prelative , resolve as presolve , sep as psep } from 'node:path' ;
18
19
import { Readable } from 'node:stream' ;
19
- import { resolve as presolve , relative as prelative , join as pjoin , sep as psep } from 'node:path' ;
20
20
21
21
// We can't use statSync, lstatSync, because some users may want to
22
22
// use graceful-fs, which doesn't support sync methods.
@@ -156,7 +156,8 @@ export class ReaddirpStream extends Readable {
156
156
this . _stat = statMethod ;
157
157
}
158
158
159
- this . _maxDepth = opts . depth ?? defaultOptions . depth ! ;
159
+ this . _maxDepth =
160
+ opts . depth != null && Number . isSafeInteger ( opts . depth ) ? opts . depth : defaultOptions . depth ! ;
160
161
this . _wantsDir = type ? DIR_TYPES . has ( type ) : false ;
161
162
this . _wantsFile = type ? FILE_TYPES . has ( type ) : false ;
162
163
this . _wantsEverything = type === EntryTypes . EVERYTHING_TYPE ;
0 commit comments