Private
optGet the value contained within the optional. The value is returned without any checks, so it might be null or undefined.
Returns true if this optional is not empty, false otherwise.
Returns true if this optional is empty, false otherwise
Utility for checking equality against the value contained within this optional
value to check against
true if this optional is this value
If there's a value, returns the result of applying a predicate on the value contained within this optional, or false when no value exists.
function that test the value
false if this optional is empty or the result of applying the predicate
Static
isChecks that a value is neither null nor undefined.
Has the added benefit of type narrowing in typescript.
value that can be undefined or null
true if the value is neither undefined or null
Static
isStatic
ofThe preffered way to create an optional. This also automatically unwraps optionals if you try to create an optional of an optional.
to be treated as an optional
a new Optional
Generated using TypeDoc
A special type that encourages the move away from null and undefined.
An Optional is immutable and is a wrapper type of T | null | undefined that provides useful functions for transformation and safe retrieval of an optional value.