True Myth / toolbelt / toMaybe
Function: toMaybe()
toMaybe<
T
>(result
):Maybe
<T
>
The converted type will be Just
if the Result
is Ok
or Nothing
if the Result
is Err
; the wrapped error value will be discarded.
Type Parameters
T
T
extends object
Parameters
result
Result
<T
, unknown
>
The Result
to convert to a Maybe
Returns
Maybe
<T
>
Just
the value in result
if it is Ok
; otherwise Nothing