Skip to content

Interface: ParsedPattern

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

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

Everything that this library reads from one route pattern.

Properties

PropertyModifierTypeDescriptionDefined in
bareFormreadonlystring | nullThe path that the pattern matches when every optional part is absent, or null when the pattern holds a part that a path must fill. /settings/:section? gives /settings, /a/{b}?/c gives /a//c, and /profile/:userId gives null.packages/play-url/src/pattern-grammar.ts:152
declaredNamesreadonlyReadonlyMap<string, string>The map from each rewritten group name back to the name that the pattern declares, for example cat_id to cat-id. The map holds an entry only for a name that the rewrite changed. It is empty for most patterns, and a caller that reads a group name falls back to the name itself.packages/play-url/src/pattern-grammar.ts:182
indexKeyreadonlystringThe key of the bucket index: the first path segment, or "*" when a param can stand in the first segment.packages/play-url/src/pattern-grammar.ts:169
literalPathreadonlystring | nullThe ONE path that the pattern matches, with each escape resolved, or null when the pattern describes a SET of paths. /users gives /users, /tags/c\+\+ gives /tags/c++, /x{y}z gives /xyz, and /profile/:userId gives null. A bridge writes a real browser URL from this field. The SOURCE of the pattern is no substitute for it: /tags/c\+\+ carries two backslashes that the address bar must not hold, and a location that carries them matches the route never.packages/play-url/src/pattern-grammar.ts:164
namesreadonlyreadonly string[]The name of every param of params, in the same order. resolveFrameworkParams runs on EVERY navigation and it needs this list each time. The parse holds it, so a navigation allocates none. A caller that hands the array to somebody else copies it: the cache holds this one.packages/play-url/src/pattern-grammar.ts:129
normalizedreadonlystringThe pattern in the form that URLPattern compiles: each param name that holds a hyphen carries an underscore instead.packages/play-url/src/pattern-grammar.ts:174
parameterizedreadonlybooleanTrue when the pattern needs a URLPattern match, and false when it is a literal path. A malformed pattern reports true, so that it reaches the URLPattern constructor and fails there with the error of the API. A parser that called it static would send it to the exact-match map instead, where it matches nothing and reports no fault.packages/play-url/src/pattern-grammar.ts:144
paramsreadonlyreadonly PatternParam[]The NAMED params, in the order that the pattern declares them.packages/play-url/src/pattern-grammar.ts:121
partsreadonlyreadonly PatternPart[]The parts, in the order that the pattern declares them.packages/play-url/src/pattern-grammar.ts:119
requiredNamesreadonlyreadonly string[]The name of every param that a path must fill, in the order of params. The same rule as names: the parse holds the array, and a navigation reads it.packages/play-url/src/pattern-grammar.ts:135
sourcereadonlystringThe pattern as the caller wrote it.packages/play-url/src/pattern-grammar.ts:117