The type of the value contained in the Option
Readonly
_Whether this Option contains no value
The number of elements in this Option (0 or 1)
Readonly
valueThe contained value (undefined for None)
Checks if this Option contains the specified value
The value to check for
true if this Option contains the value, false otherwise
Counts elements that satisfy the predicate. For single-value containers: returns 0 or 1 For collections: returns the count of matching elements
Tests whether any element satisfies the predicate. For single-value containers: tests the single value For collections: returns true if any element matches
Applies an effect function to each element. For single-value containers: applies to the value if present For collections: applies to each element
Returns the contained value or throws an error if None
Optional
error: ErrorOptional custom error to throw. If not provided, throws a default error
The contained value
Returns the contained value or undefined if None
The contained value or undefined
Converts this container to a Promise
The behavior depends on the implementing container:
A Promise that resolves or rejects based on the container's state
Returns a string representation of this Option
A string representation
Converts this monad to a Try.
Conversion rules:
A Try containing Success with the value or Failure with an appropriate error
Returns a simple object representation of this Option
An object with _tag and value properties
The Option type represents a value that may or may not exist. It's used to handle potentially null or undefined values in a type-safe way.