A convenience method for the folktale/conversions/nullable-to-result
module.
A convenience method for the folktale/conversions/nullable-to-result
module.
const Result = require('folktale/result');
Result.fromNullable(1);
// ==> Result.Ok(1)
Result.fromNullable(null);
// ==> Result.Error(null)
Result.fromNullable(undefined);
// ==> Result.Error(undefined)
fromNullable(aNullable) {
return require('folktale/conversions/nullable-to-result')(aNullable);
}