/** * Options accepted by {@link match} and {@link matcher}. * * Mirrors `picomatch.PicomatchOptions`; passed straight through to * [`picomatch`](https://github.com/micromatch/picomatch#options); see its * documentation for the full list. */ interface MatchOptions { basename?: boolean; bash?: boolean; capture?: boolean; contains?: boolean; debug?: boolean; dot?: boolean; expandRange?: ((from: string, to: string, options: MatchOptions) => string) | ((from: string, to: string, step: string, options: MatchOptions) => string); fastpaths?: boolean; flags?: string; format?: (string_: string) => string; ignore?: string | string[]; keepQuotes?: boolean; literalBrackets?: boolean; matchBase?: boolean; maxLength?: number; nobrace?: boolean; nobracket?: boolean; nocase?: boolean; noext?: boolean; noextglob?: boolean; noglobstar?: boolean; nonegate?: boolean; onIgnore?: (result: unknown) => void; onMatch?: (result: unknown) => void; onResult?: (result: unknown) => void; posix?: boolean; prepend?: boolean; regex?: boolean; strictBrackets?: boolean; strictSlashes?: boolean; unescape?: boolean; windows?: boolean; } /** * Tests whether a path matches one or more glob patterns. * * Powered by [`picomatch`](https://github.com/micromatch/picomatch) which is bundled into the built output so it does * not appear as a runtime dependency of `@visulima/fs`. * * If you match many values against the same pattern, prefer {@link matcher} to compile the pattern once. * @param value The path (or paths) to test. * @param pattern A single glob or array of globs. * @param options Optional picomatch options. See {@link MatchOptions}. * @returns `true` if `value` matches any of `pattern`. * @example * ```javascript * import { match } from "@visulima/fs"; * * match("src/index.ts", "src/**\/*.ts"); // true * match("src/index.ts", ["**\/*.js", "**\/*.ts"]); // true * match("src/index.ts", "**\/*.js"); // false * ``` */ declare const match: (value: string | string[], pattern: string | string[], options?: MatchOptions) => boolean; /** * Compiles a glob pattern into a reusable matcher function. * * Powered by [`picomatch`](https://github.com/micromatch/picomatch) which is bundled into the built output so it does * not appear as a runtime dependency of `@visulima/fs`. * @param pattern A single glob or array of globs. * @param options Optional picomatch options. See {@link MatchOptions}. * @returns A function that returns `true` when its argument matches the compiled pattern. * @example * ```javascript * import { matcher } from "@visulima/fs"; * * const isTs = matcher("**\/*.ts"); * ["a.ts", "b.js", "c.ts"].filter(isTs); // ["a.ts", "c.ts"] * ``` */ declare const matcher: (pattern: string | string[], options?: MatchOptions) => (value: string) => boolean; export { MatchOptions, match, matcher };