# prefixOf

`function` in `custom-id` · v0.3.2

<https://seedcord.org/docs/packages/custom-id/0.3.2/functions/prefix-of>

Strip the layout hash off a wire and return the prefix that the customId was declared with.

Route on this. A click on a component built before a shape change still reaches the same handler
because changing a shape doesn't change its prefix. [`decode`](/docs/packages/custom-id/0.3.2/classes/custom-id#decode) then throws the stale error there.
Returns an empty string when the wire is missing its colon or its routeKey is too short to carry a hash.

```ts
prefixOf(wire: string): string
```

Strip the layout hash off a wire and return the prefix that the customId was declared with.

Route on this. A click on a component built before a shape change still reaches the same handler
because changing a shape doesn't change its prefix. [`decode`](/docs/packages/custom-id/0.3.2/classes/custom-id#decode) then throws the stale error there.
Returns an empty string when the wire is missing its colon or its routeKey is too short to carry a hash.

Parameters.

- `wire` `string` — The customId string from the interaction.

Returns `string`.
