The type of the value contained in this Some instance.
Creates an Optional with the given value. If null or undefined is provided a None
will be returned, otherwise a Some containing the given value will be returned.
const one = Optional.fromNullable(1); // one.unwrapOr(0) === 1
const none = Optional.fromNullable(null); // none.unwrapOr(0) === 0
const nope = Optional.fromNullable(); // nope.unwrapOr(0) === 0
The type of the value that the new Optional will contain.
Generated using TypeDoc
Some
A type that represents the presence of a value.
This type is not intended to be used or instantiated directly. Instead, Some instances can be created with Optional.some and can then be manipulated with any method available on Optional.
Please see the Optional documentation for more information.
Note:
All Some methods are documented at the Optional level.