The record type of the contained object
Readonly_Readonly[toReadonlydataThe contained object value
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
Check if a key exists
The key to check
true if the key exists
Pattern matches against this data structure, applying handlers for each variant based on tag. Similar to fold but with stronger type safety for tag-based variants.
The return type is inferred from the pattern handlers when not explicitly specified.
The result of applying the matching handler function
Returns this container if it has a value, otherwise returns the alternative container.
The alternative may carry a different type; the result widens to Extractable<T | T2>.
The alternative container
This container or the alternative
Extract the value or throw an error
Optionalerror: ErrorOptional custom error to throw. If not provided, uses type-appropriate default error
The contained value
Converts this monad to an Either.
Conversion rules:
The value to use for the Left case when the source is empty/none/failure
An Either with the value as Right or the provided leftValue as Left
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 Obj
A string representation
Converts this monad to a Try.
Conversion rules:
A Try containing Success with the value or Failure with an appropriate error
The Obj type wraps a plain JavaScript object and provides fluent, immutable operations for building and transforming objects.
Example