Extracts the value of a Validation structure, if it's a Success, otherwise returns the provided default value.
forall a, b: (Validation a b).(b) => b
Extracts the value of a Validation structure, if it's a Success, otherwise returns the provided default value.
const { Success, Failure } = require('folktale/validation');
Success('a').getOrElse('b');
// ==> 'a'
Failure('a').getOrElse('b');
// ==> 'b'
{
/*~*/
Failure: function getOrElse(_default) {
return _default;
},
/*~*/
Success: function getOrElse(_default) {
return this.value;
}
}