map2K<A, B, R> function
A wrapper around map2, useful for chaining. The second Option is passed as the first argument.
expect(
some(1).chain(map2K(some(2), (a, int b) => a + b)),
some(3),
);
expect(
some(1).chain(map2K(none(), (a, int b) => a + b)),
none(),
);
Implementation
Option<R> Function(Option<A> optionA) map2K<A, B, R>(
Option<B> optionB,
R Function(A a, B b) f,
) =>
(optionA) => map2(f)(optionA, optionB);