Returns an iterator over the possibly contained value.
The iterator yields one value if the result is Ok
, otherwise none.
true
if the Result
is an Err
.
Optional
thisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined
is used instead.
true
if the Result
is an Err
and and the error inside of it matches a predicate.
true
if the Result
is an Ok
.
Optional
thisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined
is used instead.
true
if the Result
is an Ok
and and the value inside of it matches a predicate.
Whether this
Ok
value or Err
error is the same as the other Result
.
Another Result
or any value
true
if the other is an Result
and the Ok
value or Err
error is the same as this
via Object.is
.
Maps a Result<T, E>
to Result<T, F>
by applying a function to a contained Err
value, leaving an Ok
value untouched.
This function can be used to pass through a successful result while handling an error.
Ok
if the Result
is Ok
, otherwise returns Err(fn(error))
.
Extract the value from an Result
in a way that handles both the Ok
and Err
cases.
The value returned by the provided function.
Transposes a Result(Option)
into Option(Result)
.
Ok(Some(_))
will be mapped to `Some(Ok(_))Err(_)
will be mapped to Some(Err(_))
.Ok(_)
will be mapped to Some(Ok(_))
.Optional Error message
the contained Ok
value.
Optional Error message
the contained Err
error.
the contained Err
error or undefined
otherwise.
Arguments passed to unwrapErrOr
are eagerly evaluated; if you are passing the result of a function call, it is recommended to use unwrapErrOrElse
, which is lazily evaluated.
the contained Ok
value or undefined
otherwise.
Static
ErrStatic
fromOK
if the value satisfies the predicate, otherwise Err
Source value
A function that returns true
if the value satisfies the predicate, otherwise false
Optional
thisArg: anyIf provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined
is used instead.
Static
isStatic
isAn Result
or any value
An Result
or any value
true
if the both are Result
and the Ok
value or Err
error are the same via Object.is
.
Static
OkStatic
tryStatic
try
The
Result
type is an immutable representation of either success (Ok
) or failure (Err
).