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

x/rimbu/deep/mod.ts>Tuple.init

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

Returns a Tuple containing all but the last element of the given tuple.

Examples

Example 1

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

Type Parameters

T extends readonly unknown[]

Parameters

tuple: readonly [...T, unknown]
  • the source tuple

Returns

Readonly<T>