A convenience method for the folktale/conversions/maybe-to-result
module.
A convenience method for the folktale/conversions/maybe-to-result
module.
const Result = require('folktale/result');
const Maybe = require('folktale/maybe');
Result.fromMaybe(Maybe.Just(1), 'error');
// ==> Result.Ok(1)
Result.fromMaybe(Maybe.Nothing(), 'error');
// ==> Result.Error('error')
fromMaybe(aMaybe, failureValue) {
return require('folktale/conversions/maybe-to-result')(aMaybe, failureValue);
}