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