Function: getRequiredPatternParamNames()
API / @xmachines/play-router / getRequiredPatternParamNames
function getRequiredPatternParamNames(pattern): string[];Defined in: play-router/src/framework-params.ts:85
The names of every param the pattern REQUIRES, so :name? is left out.
An optional segment that did not match has no value, and a framework reports none.
That is a complete answer and not a partial one, so a MIXED pattern such as
/profile/:userId/:tab? keeps the parse of the framework when only :tab is absent.
A caller that counted that absence as a gap would fall back to the URLPattern
extraction, which THROWS on a runtime with no URLPattern — for a route the framework
had already answered.
A pattern whose params are ALL optional reports nothing at all, which reads the same as “the framework matched another route”, so pickOwnParams falls back for it. resolveFrameworkParams settles that case from the PATH instead, and it needs no URLPattern to do it.
Parameters
| Parameter | Type | Description |
|---|---|---|
pattern | string | A route pattern, for example /profile/:userId/:tab?. |
Returns
string[]
The required names, in the order that the pattern declares them. A fresh
array, because readPatternParams caches the one it holds.