effect-io-ai

Package: effect
Module: Tuple

Tuple.mapSecond

Transforms the second component of a tuple with two elements using a given function.

Example

import * as assert from "node:assert"
import { mapSecond } from "effect/Tuple"

assert.deepStrictEqual(
  mapSecond(["hello", 42], n => n.toString()),
  ["hello", "42"]
)

Signature

declare const mapSecond: { <R1, R2>(f: (right: R1) => R2): <L>(self: readonly [L, R1]) => [L, R2]; <L, R1, R2>(self: readonly [L, R1], f: (right: R1) => R2): [L, R2]; }

Source

Since v2.0.0