Skip to main content
variable aperture
import { aperture } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Returns an array of n-tuples of consecutive elements.

Use Array.prototype.slice() and Array.prototype.map() to create an array of appropriate length and populate it with n-tuples of consecutive elements from arr. If n is greater than the length of arr, return an empty array.

type

<T = any>(n: number, arr: T[]) => unknown