A convenience method for the folktale/conversions/maybe-to-validation
module.
This API is still experimental, so it may change or be removed in future versions. You should not rely on it for production applications.
A convenience method for the folktale/conversions/maybe-to-validation
module.
const Maybe = require('folktale/maybe');
const Validation = require('folktale/validation');
Maybe.Just(1).toValidation(0);
// ==> Validation.Success(1)
Maybe.Nothing().toValidation(0)
// ==> Validation.Failure(0)
toValidation(fallbackValue) {
return require('folktale/conversions/maybe-to-validation')(this, fallbackValue);
}