Skip to content

Function: getNormalizedParamNameMap()

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

function getNormalizedParamNameMap(path): ReadonlyMap<string, string>;

Defined in: packages/play-url/src/url-pattern-utils.ts:154

Builds the map from each normalized URLPattern group name back to the original param name, which holds a hyphen, of a route pattern.

The map holds only the params that normalizeParamNames rewrote. A param with a valid identifier keeps its own name, and it needs no entry.

Parameters

ParameterType
pathstring

Returns

ReadonlyMap<string, string>

Example

getNormalizedParamNameMap("/docs/:cat-id/:plain");
// → Map { "cat_id" → "cat-id" }