A convenience method for the folktale/conversions/maybe-to-validation
module.
forall a, b: (Maybe b, a) => Validation a b
A convenience method for the folktale/conversions/maybe-to-validation
module.
const Validation = require('folktale/validation');
const Maybe = require('folktale/maybe');
Validation.fromMaybe(Maybe.Just(1), 'error');
// ==> Validation.Success(1)
Validation.fromMaybe(Maybe.Nothing(), 'error');
// ==> Validation.Failure('error')
fromMaybe(aMaybe, fallbackValue) {
return require('folktale/conversions/maybe-to-validation')(aMaybe, fallbackValue);
}