Function: getCompiledPattern()
API / @xmachines/play-url / index / getCompiledPattern
function getCompiledPattern(pattern, options?): URLPatternLike;Defined in: packages/play-url/src/url-pattern-utils.ts:187
Compiles a route pattern into a URLPattern, and it uses the cache of the module level
again.
ParsedPattern.normalized carries the pattern that the compilation reads. A param name
with a hyphen (:cat-id) therefore becomes a valid URLPattern identifier (:cat_id).
A caller that reads the values of the groups must map each normalized name back with
ParsedPattern.declaredNames.
Parameters
| Parameter | Type | Description |
|---|---|---|
pattern | string | The string of the route pattern, for example /profile/:userId |
options | CompileOptions | See CompileOptions. This function reads TWO caches, so neither option is named cache: one holds the PARSE and the other holds the COMPILED pattern. |
Returns
Throws
When URLPattern cannot compile the pattern.