if this Option contains a value, this is the type of the value
Takes a function which takes the value contained in this and returns a
new Option; calls it and returns the result if this is Some,
otherwise returns None. Also sometimes known in other languages or
libraries as flatmap or bind.
the type contained in the Option returned by fn
the result of calling fn if this is Some, None otherwise
Takes a function which takes the value contained in this and returns a
promise which resolves to a new Option; calls it and returns the
result if this is Some, otherwise returns a promise which resolves to
None. This is an async version of andThen.
the type contained in the Option returned by fn
the result of calling fn if this is Some, None otherwise
Takes two functions, one is called with the contained value if this is
Some and the other is called if this is None.
the type of the return value of the matcher functions
the return value of the Some or None matcher function
Returns the contained value if this is Some, otherwise call the
provided function and return the result.
the contained if this is Some, otherwise the return value from
calling defaultValue
If this is a Some, return an Result.Ok with the contained
value. Otherwise, return an Result.Err containing the passed
default error value.
the type of error (and the error type of the returned
Result)
Result.Ok containing the value in this if this is
Some, otherwise Result.Err containing error
If this is a Some, return an Result.Ok with the contained
value. Otherwise, return an Result.Err with the value returned by
calling the passed function.
the return type of fn (and the error type of the returned
Result)
Result.Ok containing the value in this if this is
Some, otherwise Result.Err containing the value returned by
error
if this is None, returns Result.Ok containing None;
if this is Some and the Result in this is Result.Err,
returns the Result.Err; otherwise returns Result.Ok
containing Some containing the value in the Result in this
If this is None, returns None. Otherwise, calls the predicate on the
value contained in this; if the predicate returns true then this is
returned, if the predicate returns false then None is returned.
None if this is None or if fn returns false when applied
to the value in this, this otherwise
Transforms Option<T> to Option<U> by applying the provided function to
the contained value of Some and leaving None values unchanged.
the type of the return value of fn
None if this is None, otherwise Some containing the result
of applying fn to the value in this
Transforms Option<T> to Promise<Option<U>> by applying the provided
async function to the contained value of Some and resolving None values
unchanged.
the type of the value in the promise returned by fn
a promise resolving to None if this is None, otherwise a
promise resolving to Some containing the value resolved by the promise
returned from applying fn to the value in this
Applies the provided function to the contained value if this is Some,
otherwise returns the provided default value.
the type of defaultValue and the value returned by fn
the result of applying fn to the value in this if this is
Some, otherwise defaultValue
Called on an Option containing a tuple -- if this is Some,
returns a tuple of Some containing the contained values. Otherwise,
returns a tuple of None.
the type of the first value in the tuple in this
the type of the second value in the tuple in this
a tuple of Some containing the values in the tuple contained in
this if this is Some, a tuple of None otherwise
Takes another Option, if both Option values are Some,
returns a Some containing a tuple of the contained values. Otherwise
returns None.
the type of the value in other
Some containing a tuple with the values in this and other if
both this and other are Some, None otherwise
StaticcollectTakes an Array of Option values. If any of the Option
values in the array is None, returns None. Otherwise, returns Some
containing an Array of each value inside each Option in the
original list.
the type contained by the Option values
Some containing an Array of values contained by each Option in the original Array if all Option values in the original
list are Some, None otherwise
A type which represents values that may or may not be present, without using
undefinedornull.