Package: effect
Module: Tuple
Creates a new tuple containing only the elements at the specified indices.
When to use
Use to select a subset of elements from a tuple by position.
Details
The result order matches the order of the provided indices.
Example (Selecting elements by index)
import { Tuple } from "effect"
const result = Tuple.pick(["a", "b", "c", "d"], [0, 2, 3])
console.log(result) // ["a", "c", "d"]
See
omit – the inverse (exclude indices instead)get – extract a single elementSignature
declare const pick: { <const T extends ReadonlyArray<unknown>, const I extends ReadonlyArray<Indices<T>>>(indices: I): (self: T) => PickTuple<T, I[number]>; <const T extends ReadonlyArray<unknown>, const I extends ReadonlyArray<Indices<T>>>(self: T, indices: I): PickTuple<T, I[number]>; }
Since v4.0.0