True Myth / toolbelt / toOkOrErr
Function: toOkOrErr() 
Call Signature 
toOkOrErr<
T,E>(error,maybe):Result<T,E>
Transform the Maybe into a Result, using the wrapped value as the Ok value if the Maybe is Just; otherwise using the supplied error value for Err.
Type Parameters 
T 
T extends object
The wrapped value.
E 
E
The error type to in the Result.
Parameters 
error 
E
The error value to use if the Maybe is Nothing.
maybe 
Maybe<T>
The Maybe instance to convert.
Returns 
Result<T, E>
A Result containing the value wrapped in maybe in an Ok, or error in an Err.
Call Signature 
toOkOrErr<
T,E>(error): (maybe) =>Result<T,E>
Transform the Maybe into a Result, using the wrapped value as the Ok value if the Maybe is Just; otherwise using the supplied error value for Err.
Type Parameters 
T 
T extends object
The wrapped value.
E 
E
The error type to in the Result.
Parameters 
error 
E
The error value to use if the Maybe is Nothing.
Returns 
A Result containing the value wrapped in maybe in an Ok, or error in an Err.
(
maybe):Result<T,E>
Parameters 
maybe 
Maybe<T>
Returns 
Result<T, E>