If this
is ok
, calls the provided callback with the inner value
and returns the callback's return value.
Otherwise, returns this
.
The callback is called lazily (i.e., if this
is err
, the callback
will never be called).
A function that returns an Result
to return if this
is some
.
Returns an empty array if this
is err
,
otherwise returns a one-item array containing
the inner value.
Similar to Rust's Result::iter()
.
Returns the inner value wrapped in some
if this
is
err
.
Otherwise, returns none
.
If this
is err
, returns the return value of the provided
predicate.
Otherwise, returns false
.
Returns the inner value if this
is ok
,
otherwise throwing an error with the provided message.
The message of the error to throw if this
is err
.
Returns the inner value if this
is ok
,
otherwise throwing the provided error.
The error to throw if this
is none
.
Returns the inner value if this
is err
,
otherwise throwing an error with the provided message.
The message of the error to throw if this
is ok
.
Returns the inner value if this
is err
,
otherwise throwing the provided error.
The error to throw if this
is ok
.
Calls the provided callback if this
is err
.
A callback that will be called if this
is err
.
Calls the provided callback with the value that this
wraps
if this
is ok
.
This method is the same as Result.prototype.map()
except that it discards the value returned by
the callback, unconditionally returning undefined.
A callback that will be called if this
is ok
.
Applies a function to the inner value if this
is ok
.
Otherwise, returns the err
untouched.
A function that will be called if this
is ok
.
Applies a function to the inner value if this
is err
.
Otherwise, returns the ok
untouched.
A function that will be called if this
is err
.
Accepts an object with two callbacks.
One will be called if this
is ok
.
The other will be called if this
is err
.
In either case, the inner value gets
passed to the callback.
Returns the return value of whichever callback gets called.
An object with callbacks for ok
and err
.
Returns the inner value wrapped in some
if this
is
ok
.
Otherwise, returns none
.
If this
is ok
, returns the return value of the provided
predicate.
Otherwise, returns false
.
If this is ok(t)
, returns err(t)
.
If this is err(e)
, so this returns ok(e)
.
Same as unwrap()
except this method will never
throw, since this
cannot be err
(because
the error type is never
).
Same as unwrapErr()
except this method will never
throw, since this
cannot be ok
(because
the ok type is never
).
Returns the inner value if this
is ok
,
otherwise throwing an error.
Returns the inner value if this
is err
,
otherwise throwing an error.
Returns the inner value if this
is err
,
otherwise throws the inner value.
Returns the inner value if this
is ok
,
otherwise returns the provided default.
The value to return if this
is none
.
Returns the inner value if this
is ok
,
otherwise calls the provided thunk and returns its return value.
The thunk is called lazily (i.e., if this
is ok
, the thunk
will never be called because there is no need for a default value).
A callback that returns the value to return if this
is err
.
Returns the inner value if this
is ok
,
otherwise throws the inner value.
Generated using TypeDoc
Represents a success (
ok
) or failure (err
).