Function: sanitizePathname()
API / @xmachines/play-router / index / sanitizePathname
function sanitizePathname(pathname): string | null;Defined in: packages/play-url/src/location.ts:89
Reads the pathname of a location, and refuses a location that no route can match.
The function removes the query and the fragment, and it joins every run of separators
into one: //docs//api gives /docs/api. A route map holds one pattern for one path,
and a doubled separator is the same path written another way.
Parameters
| Parameter | Type | Description |
|---|---|---|
pathname | string | The raw value that a framework router reports. |
Returns
string | null
The clean pathname, or null when the value is longer than 2048 characters.