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

x/rimbu/core/main/exports.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@1.0.3/core/main/exports.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