maybeAsValue
Callable
Type parameters
- T: unknown
The type of the value encapsulated by Just.
Parameters
x: T
The Maybe value to extract the value from.
Returns [Nothing] extends [T] ? IsEqual<T, Nothing> extends true ? undefined : Just<T> | undefined : Just<T>
The value contained within Just, or undefined if the input is Nothing.
- T: unknown
This function checks if the provided Maybe value is a Just and returns the contained value. If the value is Nothing, it returns undefined, effectively handling optional values in your code.
Example