A convenience method for the folktale/conversions/result-to-maybe module.
A convenience method for the folktale/conversions/result-to-maybe module.
Note that Error values are discarded, since Nothing can't hold a value.
const Maybe = require('folktale/maybe');
const Result = require('folktale/result');
Maybe.fromResult(Result.Ok(1));
// ==> Maybe.Just(1)
Maybe.fromResult(Result.Error(1));
// ==> Maybe.Nothing()
fromResult(aResult) {
return require('folktale/conversions/result-to-maybe')(aResult);
}