(dir: string, { filter }: ReaddirPOptions)
| 36 | } |
| 37 | |
| 38 | export async function readdirp(dir: string, { filter }: ReaddirPOptions): Promise<string[]> { |
| 39 | const dirContent = await readdir(dir, { recursive: true }); |
| 40 | const dirContentWalker: WalkerItem[] = []; |
| 41 | const filteredContent: string[] = []; |
| 42 | dirContent.forEach((element) => { |
| 43 | const path = join(dir, element); |
| 44 | const stats = statSync(path); |
| 45 | dirContentWalker.push({ path, stats }); |
| 46 | }); |
| 47 | dirContentWalker.forEach((element) => { |
| 48 | if (filter(element)) { |
| 49 | filteredContent.push(element.path); |
| 50 | } |
| 51 | }); |
| 52 | return filteredContent; |
| 53 | } |
no outgoing calls
no test coverage detected