x/path_to_regexp@v6.2.1

Turn a path string such as `/user/:name` into a regular expression
GitHub Stars
7111
Latest
import * as pathToRegexp from "https://deno.land/x/path_to_regexp@v6.2.1/index.ts";

Functions

compile

Compile a string to a template function for the path.

match

Create path match function from path-to-regexp spec.

parse

Parse a string for the raw tokens.

pathToRegexp

Normalize the given path string, returning a regular expression.

regexpToFunction

Create a path match function from path-to-regexp output.

tokensToFunction

Expose a method for transforming tokens into the path function.

tokensToRegexp

Expose a function for taking tokens and returning a RegExp.

Interfaces

Key

Metadata about a key.

MatchResult

A match result contains data about the path match.

ParseOptions
RegexpToFunctionOptions
TokensToFunctionOptions
TokensToRegexpOptions

Type Aliases

Match

A match is either false (no match) or a match result.

MatchFunction

The match function takes a string and returns whether it matched the path.

Path

Supported path-to-regexp input types.

PathFunction
Token

A token is a string (nothing special) or key metadata (capture group).