Unwraps an Optional
, returning the contained value or undefined
if
empty.
This function provides a safe way to extract values from Optionals without throwing exceptions. It has overloaded behavior based on the type:
Optional.Some<T>
: Always returns T
(guaranteed by type system)Optional<T>
: Returns T | undefined
The Optional
to unwrap.
The contained value if Optional.Some
, otherwise undefined
.
Unwraps an
Optional
, returning the contained value orundefined
if empty.This function provides a safe way to extract values from Optionals without throwing exceptions. It has overloaded behavior based on the type:
Optional.Some<T>
: Always returnsT
(guaranteed by type system)Optional<T>
: ReturnsT | undefined