The value contained in an Failure instance of the Validation structure.
The value contained in an Failure instance of the Validation structure.
This is usually used to destructure the instance in a .matchWith
call.
const Validation = require('folktale/validation');
Validation.Failure(1).matchWith({
Failure: ({ value }) => value, // equivalent to (x) => x.value
Success: ({ value }) => 'nothing'
});
// ==> 1
get value() {
throw new TypeError('`value` can’t be accessed in an abstract instance of Validation.Failure');
}