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