import { match } from 'path-to-regexp'; import type { Path, MatchFunction } from 'path-to-regexp'; export { type Path }; type Params = Parameters; /** Create a match function from a path pattern that checks if a URLs matches it. */ export const matchPath =

( path: Params[0], options?: Params[1] ): MatchFunction

=> { if (Array.isArray(path) && !path.length) { path = ''; } try { return match

(path, options); } catch (error) { throw new Error(`[swup] Error parsing path "${String(path)}":\n${String(error)}`); } };