effect-io-ai

Package: effect
Module: Function

Function.tupled

Creates a tupled version of this function: instead of n arguments, it accepts a single tuple argument.

When to use

Use to adapt a multi-argument function so it accepts one tuple argument.

Example (Converting arguments to a tuple)

import { Function } from "effect"
import * as assert from "node:assert"

const sumTupled = Function.tupled((x: number, y: number): number => x + y)

assert.deepStrictEqual(sumTupled([1, 2]), 3)

See

Signature

declare const tupled: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => B) => (a: A) => B

Source

Since v2.0.0