compileGlob
Compiles a glob to a predicate.
Compiles a glob to a predicate.
Import#
ts
import { compileGlob } from "@shadow-js/dusk/vite";
Signature#
ts
function compileGlob(pattern: string): (path: string) => boolean
Parameters#
| Name | Description |
|---|---|
pattern |
Glob such as **\/*.server.ts; a ** matches any number of folders. |
Returns#
A function that tells whether a relative POSIX path matches.
Throws#
- TypeError for an unbalanced brace or a brace group that expands to too many patterns.
Examples#
ts
compileGlob("**\/*.server.{ts,tsx}")("src/a/db.server.ts"); // true