Skip to main content
The Deno 2 Release Candidate is here
Learn more
Go to Latest
function pathToRegexp
import { pathToRegexp } from "https://deno.land/x/frugal@0.2.1/dep/path-to-regexp.ts";

Normalize the given path string, returning a regular expression.

An empty array can be passed in for the keys, which will hold the placeholder key descriptions. For example, using /user/:id, keys will contain [{ name: 'id', delimiter: '/', optional: false, repeat: false }].

Parameters

path: Path
optional
keys: Key[]

Returns

RegExp