normalizeSlotRoute
normalizeSlotRoute(
input):string|null
Normalize a path, URL or route pattern into a slot route.
Strips any origin, query string and fragment; collapses duplicate slashes
and a trailing slash; keeps route-pattern segments ([id], :id)
verbatim; templates identifier-like segments to :id; bounds the result to
SLOT_ROUTE_MAX_LENGTH. Returns null for empty or non-string input.
Parameters
Section titled “Parameters”string | null | undefined
Returns
Section titled “Returns”string | null
Example
Section titled “Example”normalizeSlotRoute('https://app.example.com/accounts/4821/billing?tab=x#top');// → '/accounts/:id/billing'normalizeSlotRoute('/projects/[projectId]');// → '/projects/[projectId]'