# decodeFor

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

<https://docs.seedcord.org/packages/custom-id/0.2.1/decode-for>

Decode a wire against several customIds at once, for a handler serving more than one.

Matching runs on the prefix. The result pairs the matched prefix with that definition's own params. Switching on `prefix` narrows both together.

```ts
decodeFor<Defs>(
    defs: Defs,
    wire: string
): DecodedRoute<Defs>
```

Decode a wire against several customIds at once, for a handler serving more than one.

Matching runs on the prefix. The result pairs the matched prefix with that definition's own params. Switching on `prefix` narrows both together.

Parameters.

- `defs` `Defs` — The customId definitions to try, in order.
- `wire` `string` — The customId string from the interaction.

Returns `DecodedRoute<Defs>`.
