-
Notifications
You must be signed in to change notification settings - Fork 295
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- use Sets instead of Arrays in Nodes for faster lookups - Use flatMap instead of flatten
- Loading branch information
1 parent
426d653
commit a312558
Showing
5 changed files
with
30 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import * as glob from 'glob'; | ||
import { promisify } from 'util'; | ||
import { flatten, toArray } from './array'; | ||
import { toArray } from './array'; | ||
|
||
const globPromise = promisify(glob); | ||
|
||
export async function globFiles(pattern: string | string[], options?: glob.IOptions): Promise<string[]> { | ||
const files = await Promise.all<string[]>(toArray(pattern).map(p => globPromise(p, options))); | ||
|
||
return flatten(files); | ||
return files.flatMap(x => x); | ||
} |