Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rimbu/deep/tuple.ts>Tuple.getIndex

Rimbu is a TypeScript library focused on immutable, performant, and type-safe collections and other tools.
Go to Latest
function Tuple.getIndex
import { Tuple } from "https://deno.land/x/rimbu@0.13.5/deep/tuple.ts";
const { getIndex } = Tuple;

Returns the item at the given index in the givn tuple.

Examples

Example 1

const t = Tuple.of(1, 'a', true)
console.log(Tuple.getIndex(t, 1))
// => 'a'

Type Parameters

T extends Tuple.Source
optional
K extends keyof T = keyof T

Parameters

tuple: T
  • the tuple to get the item from
index: K
  • the index in of the tuple element