Input to the mapping function
The mapping function returns a value of this type
Your mapping function
The decoder to run before calling your function
// Add 42 to a number
const add_42_decoder = Decode.map(value => value + 42, Decode.number);
decode(add_42_decoder, 0) === 42
decode(add_42_decoder, -42) === 0
decode(add_42_decoder, 42) === 84
decode(add_42_decoder, 'text') // Fails
// Convert any value to its string representation.
const to_string_decoder = Decode.map(value => String(value), Decode.unknown);
decode(to_string_decoder, 42) === '42'
decode(to_string_decoder, {}) === '[object Object]'
decode(to_string_decoder, 'text') === 'text'
decode(to_string_decoder, Symbol('my_symbol')) === 'Symbol(my_symbol)'
Generated using TypeDoc
Take the value decoded by the given decoder and transform it.