Skip to content

Function: parsePattern()

API / @xmachines/play-url / index / parsePattern

function parsePattern(pattern, options?): ParsedPattern;

Defined in: packages/play-pattern/src/pattern-grammar.ts:264

Reads a route pattern, one time for each distinct pattern.

The parser reports a fault never. A pattern that it cannot read reports parameterized: true and bareForm: null, which sends it to the URLPattern constructor and keeps every derived answer on the safe side.

Parameters

ParameterTypeDescription
patternstringThe route pattern, for example /profile/:userId.
options?ParseOptions-

Returns

ParsedPattern

The parse. The caller treats it as read-only: the cache holds this object.