Skip to content

Function: cleanFrameworkParams()

API / @xmachines/play-router / index / cleanFrameworkParams

function cleanFrameworkParams(params): Record<string, string>;

Defined in: packages/play-url/src/framework-params.ts:148

The params of a framework router, in the shape that pickOwnParams reads.

Every framework reports a param that its own route DECLARES and that the location did not fill: Vue Router gives undefined or "", and SolidJS Router does the same. Such an entry is not an answer, and a pick that kept it would send an empty value to the actor as though the path carried one. Drop it here instead, one time, because the rule belongs to the decision of resolveFrameworkParams and not to a bridge: VueRouterBridge and SolidRouterBridge held one copy each.

A value of an array — the splat of a catch-all route of Vue Router — becomes its String() form, exactly as a single value does.

The result has a null prototype, for the same reason pickOwnParams gives: a plain {} accumulator turns cleaned["__proto__"] = value into a write of the PROTOTYPE setter, which drops a string value in silence. pickOwnParams then read Object.hasOwn(params, "__proto__") as false, called the pick incomplete, and fell back to the URLPattern extraction, for a route the framework had answered already.

Parameters

ParameterTypeDescription
paramsRecord<string, unknown>The raw params of the framework router.

Returns

Record<string, string>

The params with no absent value, each one a string.