# prefixOf

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

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

Recover the stable prefix from a wire by stripping its layout hash.

Route on this. The prefix survives a shape change. A click on a component built before the change still reaches the same place, where [`decode`](/packages/custom-id/0.2.1/classes/custom-id#decode) refuses it. Returns an empty string for a wire too short to carry a hash.

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

Recover the stable prefix from a wire by stripping its layout hash.

Route on this. The prefix survives a shape change. A click on a component built before the change still reaches the same place, where [`decode`](/packages/custom-id/0.2.1/classes/custom-id#decode) refuses it. Returns an empty string for a wire too short to carry a hash.

Parameters.

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

Returns `string`.
