If this is some, calls the provided callback with the value
that this wraps and returns the callback's return value.
Otherwise, returns Option.none().
The callback is called lazily (i.e., if this is none, the callback
will never be called).
A function that returns an Option to return if this is some.
Returns an empty array if this is none,
otherwise returns a one-item array containing
the value that this wraps.
Similar to Rust's Option::iter().
Returns false if this is none,
otherwise returns whether the value that this
wraps equals the provided value (equality is
determined using ===).
In other words, this method returns true if and only if
this is some(v) and v === other.
Returns the value that this wraps if this is some,
otherwise throwing an UnwrapError with the provided message.
The message of the UnwrapError to throw if this is none.
Returns the value that this wraps if this is some,
otherwise throwing the provided error.
The error to throw if this is none.
Returns Option.none() if this is none,
otherwise calls the provided predicate with the value
that this wraps and returns this if the predicate returns true
and Option.none() if the predicate returns false.
The callback that returns whether to keep the wrapped value.
Calls the provided callback if this is none.
A callback that will be called if this is none.
Calls the provided callback with the value that this wraps
if this is some.
This method is the same as Option.prototype.map()
except that it discards the value returned by
the callback, unconditionally returning undefined.
A callback that will be called if this is some.
Returns Option.none() if this is none,
and Option.some(mapper(x)) where x is
the value that this wraps.
A function that will be called if this is some.
Accepts an object with two callbacks.
One will be called if this is none.
The other will be called with the value
that this wraps if this is some.
Returns the return value of whichever callback gets called.
An object with callbacks for none and some.
Returns false if this is none,
otherwise returns whether the value that this
wraps satisfies the provided predicate.
In other words, this method returns true if and only if
this is some(v) and predicate(v) is true.
The callback to call if this
is some.
Returns the value that this wraps if this is some,
otherwise throwing an UnwrapError.
Returns the value that this wraps if this is some,
otherwise returns the provided default.
The value to return if this is none.
Returns the value that this wraps if this is some,
otherwise calls the provided thunk and returns its return value.
The thunk is called lazily (i.e., if this is some, 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 none.
Generated using TypeDoc
A wrapper representing a value that may be missing.