Decoder for array items
Decoder for an array of things
Suppose we have a decoder for Users
class User {}
const user_decoder = Decode.instance(User, {
id: Decode.field('id', Decode.integer),
name: Decode.field('name', Decode.string),
});
Using Decode.many we can easily build a decoder for a list of users:
const decoder = Decode.many(user_decoder);
decode(decoder, [ {id: 1, name: 'Jeff'}, {id: 2, name: 'Jake'} ]);
Generated using TypeDoc
Make a decoder that can be used for decoding arrays, where every value is run through the given child decoder.