Chains a new Result to the current one if it is Ok, but asynchronously.
The async mapper function to apply to the value if it is an Ok.
A new Result with the mapped value if it is an Ok, otherwise the value as-is.
Maps the Result so the Ok
value is wrapped in an Option based on its presence.
If the Result is an Ok
and the value is not null or undefined, then the inner value will become Some
.
If the Result is an Ok
and the value is null or undefined, then the inner value will become None
.
If the Result is an Err
, then nothing will happen.
A new Result with the Ok
value wrapped in an Option based on its presence.
Returns the value if it is a Left, otherwise returns a default value asynchronously.
The default value (as-is or produced from a callback) to return if the value is a Right.
The value if it is a Left, otherwise the default value.
Maps the value if it is an Ok, but asynchronously.
The async mapper function to apply to the value if it is an Ok.
A new Result with the mapped value if it is an Ok, otherwise the result as-is.
Maps the error if it is an Err, but asynchronously.
The async mapper function to apply to the error if it is an Err.
A new Result with the mapped error if it is an Err, otherwise the result as-is.
Maps the value if it is a Left asynchronously, otherwise returns the value as-is.
The async function to apply to the value if it is a Left.
A new Either with the mapped value if it is a Left, otherwise the value as-is.
Maps the value if it is a Right asynchronously, otherwise returns the value as-is.
The async function to apply to the value if it is a Right.
A new Either with the mapped value if it is a Right, otherwise the value as-is.
Matches the jonad by calling the appropriate callback based on the value type asynchronously.
If the value is a Left, this callback is called with the value.
If the value is a Right, this callback is called with the value.
The result of the callback that was called.
Returns the value if it is a Right, otherwise returns a default value asynchronously.
The default value (as-is or produced from a callback) to return if the value is a Left.
The value if it is a Right, otherwise the default value.
Maps the Result into an Option.
If the Result is an Ok
and the value is not null or undefined, then it will be Some
with that value.
If the Result is an Ok
and the value is null or undefined, then it will be None
.
If the Result is an Err
, then it will be None
with the error discarded.
Some
if the value is Ok
and present, otherwise None
.
Returns the value if it is an Ok, otherwise returns a default value asynchronously.
The default value (as-is or produced from a callback) to return if the value is an Err.
The value if it is an Ok, otherwise the default value.
A Result jonad, a subtype of Either.
Represents a value ("Ok") or an error ("Err"). Associates a set of utility functions to work with the jonad.