separate<A, B> static method

(Option<A>, Option<B>) separate<A, B>(
  1. Option<Either<A, B>> m
)

Return a record of Option from a Option<Either<A, B>>.

The value on the left of the Either will be the first value of the tuple, while the right value of the Either will be the second of the tuple.

Implementation

static (Option<A>, Option<B>) separate<A, B>(Option<Either<A, B>> m) =>
    m.match(
      () => (const Option.none(), const Option.none()),
      (either) => (either.getLeft(), either.getRight()),
    );