Package: effect
Module: Option
Sequences two Options, keeping the value from the first if both are Some.
When to use
Use when you need two Option values to both be Some, then keep only the
first value.
Details
Some → returns selfNone → returns NoneExample (Keeping the first value)
import { Option } from "effect"
console.log(Option.zipLeft(Option.some("hello"), Option.some(1)))
// Output: { _id: 'Option', _tag: 'Some', value: 'hello' }
console.log(Option.zipLeft(Option.some("hello"), Option.none()))
// Output: { _id: 'Option', _tag: 'None' }
See
zipRight to keep the second value insteadzipWith to combine both valuesSignature
declare const zipLeft: { <_>(that: Option<_>): <A>(self: Option<A>) => Option<A>; <A, X>(self: Option<A>, that: Option<X>): Option<A>; }
Since v2.0.0