effect-io-ai

Package: effect
Module: Option

Option.getOrUndefined

Extracts the value from a Some, or returns undefined for None.

When to use

Use when you need to pass absent Option values to APIs that expect undefined.

Details

Example (Unwrapping to undefined)

import { Option } from "effect"

console.log(Option.getOrUndefined(Option.some(1)))
// Output: 1

console.log(Option.getOrUndefined(Option.none()))
// Output: undefined

See

Signature

declare const getOrUndefined: <A>(self: Option<A>) => A | undefined

Source

Since v2.0.0