A convenience method for the folktale/conversions/validation-to-maybe
module.
A convenience method for the folktale/conversions/validation-to-maybe
module.
Note that Failure
values are discarded, since Nothing
can't hold a value.
const Maybe = require('folktale/maybe');
const Validation = require('folktale/validation');
Maybe.fromValidation(Validation.Success(1));
// ==> Maybe.Just(1)
Maybe.fromValidation(Validation.Failure(1));
// ==> Maybe.Nothing()
fromValidation(aValidation) {
return require('folktale/conversions/validation-to-maybe')(aValidation);
}