Globtypetype Glob = Brand<string, "anyfs-bridge glob">;A pattern, made only by parseGlob: its segments and whether it is anchored.
The patterns of a filter: a small glob with no regular expression in it, so that a pattern from a person can never take a long time to match. A pattern is /-separated segments. In a segment * is any run of characters and ? any one character; a segment that is ** is any number of segments, none included. A pattern with no / matches wherever a segment of the path matches it, so that node_modules or *.tmp leaves out a whole subtree; a pattern with a / is anchored at the root of the endpoint.
import { globMatches, parseGlob } from "./glob.ts";
const g = parseGlob("*.tmp");
g.kind === "ok" && globMatches(g.value, "a/b/c.tmp"); // trueGlobtypetype Glob = Brand<string, "anyfs-bridge glob">;A pattern, made only by parseGlob: its segments and whether it is anchored.
parseGlobfunctionfunction parseGlob(text: string): Result<Glob, string>A glob from text, or why it is not one: not empty, at most 512 characters, no NUL, no backslash, no empty segment, and ** only as a whole segment.
globMatchesfunctionfunction globMatches(glob: Glob, path: Path): booleanWhether a glob matches a path: anchored where it holds a /, and at any segment where it holds none.
anyGlobMatchesfunctionfunction anyGlobMatches(globs: readonly Glob[], path: Path): booleanWhether any of the globs matches the path.