chainNullable<A> function
A chainable fromNullable variant that flattens nullable values into an Option.
expect(
await some('hello').chain(chainNullable)(),
O.some('hello'),
);
expect(
await some(null).chain(chainNullable)(),
O.none(),
);
Implementation
TaskOption<A> chainNullable<A>(TaskOption<A?> taskOption) =>
taskOption.chain(flatMap(fromNullable));