Skip to content

mapBoth

mapBoth<A, C, B, D>(onFirst, onSecond): (tuple) => Tuple<C, D>

Defined in: Core/Tuple.ts:91

Transforms both values independently in a single step.

A

C

B

D

(a) => C

(b) => D

(tuple): Tuple<C, D>

Tuple<A, B>

Tuple<C, D>

pipe(
  Tuple.make("alice", 42),
  Tuple.mapBoth(
    (name) => name.toUpperCase(),
    (score) => score * 2,
  ),
); // ["ALICE", 84]