The length to take.
The taken list.
import { range, take, toIterator } from "./list.ts";
import { assertEquals } from "../deps.ts";
const taken = take(2)(range(1, 6));
const iter = toIterator(taken);
assertEquals(iter.next(), { value: 1, done: false });
assertEquals(iter.next(), { value: 2, done: false });
assertEquals(iter.next(), { value: undefined, done: true });
Generated using TypeDoc
Takes only the prefix of length
count
. Ifcount >= length(list)
, the list itself will be returned.