Skip to content

EitherTuple5Ops<E, T1, T2, T3, T4, T5>

extension EitherTuple5Ops<E, T1, T2, T3, T4, T5> on Either<E, Record>

Provides additional functions on an Either where the right value is a 5 element tuple.

Methods

ensureN() extension

Either<E, Record> ensureN(
  bool Function(T1, T2, T3, T4, T5) p,
  E Function() onFailure,
)

Available on Either<A, B>, provided by the EitherTuple5Ops<E, T1, T2, T3, T4, T5> extension

Implementation
dart
Either<E, (T1, T2, T3, T4, T5)> ensureN(
  Function5<T1, T2, T3, T4, T5, bool> p,
  Function0<E> onFailure,
) => ensure(p.tupled, onFailure);

filterOrElseN() extension

Either<E, Record> filterOrElseN(
  bool Function(T1, T2, T3, T4, T5) p,
  E Function() zero,
)

Available on Either<A, B>, provided by the EitherTuple5Ops<E, T1, T2, T3, T4, T5> extension

Implementation
dart
Either<E, (T1, T2, T3, T4, T5)> filterOrElseN(
  Function5<T1, T2, T3, T4, T5, bool> p,
  Function0<E> zero,
) => filterOrElse(p.tupled, zero);

flatMapN() extension

Either<E, T6> flatMapN<T6>(Either<E, T6> Function(T1, T2, T3, T4, T5) f)

Available on Either<A, B>, provided by the EitherTuple5Ops<E, T1, T2, T3, T4, T5> extension

Implementation
dart
Either<E, T6> flatMapN<T6>(Function5<T1, T2, T3, T4, T5, Either<E, T6>> f) => flatMap(f.tupled);

foldN() extension

T6 foldN<T6>(T6 Function(E) f, T6 Function(T1, T2, T3, T4, T5) g)

Available on Either<A, B>, provided by the EitherTuple5Ops<E, T1, T2, T3, T4, T5> extension

Implementation
dart
T6 foldN<T6>(
  Function1<E, T6> f,
  Function5<T1, T2, T3, T4, T5, T6> g,
) => fold(f, g.tupled);

foreachN() extension

void foreachN(void Function(T1, T2, T3, T4, T5) f)

Available on Either<A, B>, provided by the EitherTuple5Ops<E, T1, T2, T3, T4, T5> extension

Implementation
dart
void foreachN(Function5<T1, T2, T3, T4, T5, void> f) => foreach(f.tupled);

mapN() extension

Either<E, T6> mapN<T6>(T6 Function(T1, T2, T3, T4, T5) f)

Available on Either<A, B>, provided by the EitherTuple5Ops<E, T1, T2, T3, T4, T5> extension

Implementation
dart
Either<E, T6> mapN<T6>(Function5<T1, T2, T3, T4, T5, T6> f) => map(f.tupled);