decodeWith
Decodes a raw response with the decoder registered as name, the way the
feed, detail and identify functions do, so a host that reads a response of
its own gets the same typed refusal.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { decodeWith } from "@mapcairn/core";
function decodeWith(decoders: DecoderRegistry, name: string, raw: unknown, fields: FieldMap, prepare?: (raw: unknown) => unknown): LayerFeature[];
Parameters
decoders(DecoderRegistry)name(string)raw(unknown)fields(FieldMap)prepare?((raw: unknown) => unknown): Reshapesrawfor the decoder. It runs inside the same guard as the decoder, so a response that breaks it is refused too. It leavesrawas it is by default.
Returns
LayerFeature[]
Throws
LayerErrorinvalidwhen no decoder has that name, or whenprepareor the decoder throws.