UrlPattern

Source
import { UrlPattern } from "@prestojs/routing";

Allows definition of URL as a pattern with ability to resolve it to a URL by performing argument replacement

Patterns are defined using the path-to-regexp library

Usage:

const url = new UrlPattern('/users/:id/'),
url.resolve({ id: 5 });
// /users/5/
url.resolve({ id: 5 }, { query: { showAddresses: true }});
// /users/5/?showAddresses=true

API

new UrlPattern(pattern)

Source
ParameterTypeDescription
*patternstring

Methods

ParameterTypeDescription
*kwargs__type
*props.query__type
string

Properties