chainNullable<A> function

TaskOption<A> chainNullable<A>(
  1. TaskOption<A?> taskOption
)

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));