Decoder that only accepts a specific constant value.
const trueDecoder = JsonDecoder.constant(true);trueDecoder.decode(true); // Ok<boolean>({value: true})trueDecoder.decode(false); // Err({error: 'false is not exactly true'}) Copy
const trueDecoder = JsonDecoder.constant(true);trueDecoder.decode(true); // Ok<boolean>({value: true})trueDecoder.decode(false); // Err({error: 'false is not exactly true'})
The constant value to accept
A decoder that only accepts the specified value
Decoder that only accepts a specific constant value.
Example