A convenience method for the folktale/conversions/maybe-to-result
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-result
module.
const Maybe = require('folktale/maybe');
const Result = require('folktale/result');
Maybe.Just(1).toResult(0);
// ==> Result.Ok(1)
Maybe.Nothing().toResult(0)
// ==> Result.Error(0)
toResult(fallbackValue) {
return require('folktale/conversions/maybe-to-result')(this, fallbackValue);
}