diff options
Diffstat (limited to 'std/path/glob.ts')
-rw-r--r-- | std/path/glob.ts | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/std/path/glob.ts b/std/path/glob.ts index 5288efda9..172587626 100644 --- a/std/path/glob.ts +++ b/std/path/glob.ts @@ -41,7 +41,7 @@ export interface GlobToRegExpOptions extends GlobOptions { */ export function globToRegExp( glob: string, - { extended = false, globstar = true }: GlobToRegExpOptions = {} + { extended = false, globstar = true }: GlobToRegExpOptions = {}, ): RegExp { const result = globrex(glob, { extended, @@ -57,7 +57,8 @@ export function globToRegExp( export function isGlob(str: string): boolean { const chars: Record<string, string> = { "{": "}", "(": ")", "[": "]" }; /* eslint-disable-next-line max-len */ - const regex = /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; + const regex = + /\\(.)|(^!|\*|[\].+)]\?|\[[^\\\]]+\]|\{[^\\}]+\}|\(\?[:!=][^\\)]+\)|\([^|]+\|[^\\)]+\))/; if (str === "") { return false; @@ -89,7 +90,7 @@ export function isGlob(str: string): boolean { /** Like normalize(), but doesn't collapse "**\/.." when `globstar` is true. */ export function normalizeGlob( glob: string, - { globstar = false }: GlobOptions = {} + { globstar = false }: GlobOptions = {}, ): string { if (glob.match(/\0/g)) { throw new Error(`Glob contains invalid characters: "${glob}"`); @@ -100,7 +101,7 @@ export function normalizeGlob( const s = SEP_PATTERN.source; const badParentPattern = new RegExp( `(?<=(${s}|^)\\*\\*${s})\\.\\.(?=${s}|$)`, - "g" + "g", ); return normalize(glob.replace(badParentPattern, "\0")).replace(/\0/g, ".."); } @@ -108,7 +109,7 @@ export function normalizeGlob( /** Like join(), but doesn't collapse "**\/.." when `globstar` is true. */ export function joinGlobs( globs: string[], - { extended = false, globstar = false }: GlobOptions = {} + { extended = false, globstar = false }: GlobOptions = {}, ): string { if (!globstar || globs.length == 0) { return join(...globs); |