Skip to main content
Module

x/rimbu/mod.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.1/mod.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