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
None
A type that represents the absence of a value.
This type is not intended to be used or instantiated directly. Instead, None instances can be created with Optional.none and can then be manipulated with any method available on Optional.
Please see the Optional documentation for more information.
Note:
All None methods are documented at the Optional level.