effect-io-ai

Package: effect
Module: Tuple

Tuple.swap

Swaps the elements of a tuple with two elements.

Example

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

assert.deepStrictEqual(swap(["hello", 42]), [42, "hello"])

Signature

declare const swap: <L, R>(self: readonly [L, R]) => [R, L]

Source

Since v2.0.0