Package: effect
Module: Option
Returns the first Some found in an iterable of Options, or None if
all are None.
When to use
Use when you need the first available Some value from a priority list.
Details
SomeNone only when every element is NoneExample (Finding the first Some)
import { Option } from "effect"
console.log(Option.firstSomeOf([
Option.none(),
Option.some(1),
Option.some(2)
]))
// Output: { _id: 'Option', _tag: 'Some', value: 1 }
See
orElse for a two-option fallbackSignature
declare const firstSomeOf: <T, C extends Iterable<Option<T>> = Iterable<Option<T>>>(collection: C) => [C] extends [Iterable<Option<infer A>>] ? Option<A> : never
Since v2.0.0