diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2020-10-01 10:37:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-01 11:37:03 +0200 |
commit | 326ccb1095adeb9b8c86d42cc9d9d8566bba2788 (patch) | |
tree | 53ef304a5b6d93a7a33eb7aa7edff82dafc097ba /std/fs/expand_glob.ts | |
parent | b689e60b602be547c701094ba76fe3a545cad70d (diff) |
feat(std/path): Align globToRegExp() with bash glob expansion (#7209)
- feat: Support escaping glob characters
- feat: Support more character classes
- feat: Match characters literally on segment parse failure
- fix: Match nothing for empty globs
- fix: Contain any glob syntax to its path segment
- perf: Remove extraneous separators from generated regex
- doc: Add detailed JSDoc
- chore: Remove old copyright headers
Diffstat (limited to 'std/fs/expand_glob.ts')
-rw-r--r-- | std/fs/expand_glob.ts | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/std/fs/expand_glob.ts b/std/fs/expand_glob.ts index 72907e157..db60b2465 100644 --- a/std/fs/expand_glob.ts +++ b/std/fs/expand_glob.ts @@ -60,15 +60,17 @@ function comparePath(a: WalkEntry, b: WalkEntry): number { return 0; } -/** - * Expand the glob string from the specified `root` directory and yield each +/** Expand the glob string from the specified `root` directory and yield each * result as a `WalkEntry` object. * - * Examples: + * See [`globToRegExp()`](../path/glob.ts#globToRegExp) for details on supported + * syntax. * - * for await (const file of expandGlob("**\/*.ts")) { - * console.log(file); - * } + * Example: + * + * for await (const file of expandGlob("**\/*.ts")) { + * console.log(file); + * } */ export async function* expandGlob( glob: string, @@ -168,14 +170,13 @@ export async function* expandGlob( yield* currentMatches; } -/** - * Synchronous version of `expandGlob()`. +/** Synchronous version of `expandGlob()`. * - * Examples: + * Example: * - * for (const file of expandGlobSync("**\/*.ts")) { - * console.log(file); - * } + * for (const file of expandGlobSync("**\/*.ts")) { + * console.log(file); + * } */ export function* expandGlobSync( glob: string, |