Skip to content

tap

tap<A, B>(f): (tuple) => Tuple<A, B>

Defined in: Core/Tuple.ts:141

Runs a side effect with both values without changing the pair. Useful for logging or debugging in the middle of a pipeline.

A

B

(a, b) => void

(tuple): Tuple<A, B>

Tuple<A, B>

Tuple<A, B>

pipe(
  Tuple.make("Paris", 2_161_000),
  Tuple.tap((city, pop) => console.log(`${city}: ${pop}`)),
  Tuple.mapSecond((n) => n / 1_000_000),
); // logs "Paris: 2161000", returns ["Paris", 2.161]