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

x/itertools/more-itertools.ts

🦕 A TypeScript port of Python's itertools and more-itertools for Deno
Go to Latest
import * as itertools from "https://deno.land/x/itertools@v1.1.1/more-itertools.ts";

Functions

Break iterable into lists of length size:

Return an iterator flattening one level of nesting in a list of lists:

Yields the heads of all of the given iterables. This is almost like roundrobin(), except that the yielded outputs are grouped in to the "rounds":

Intersperse filler element value among the items in iterable.

Returns an iterable containing only the first n elements of the given iterable.

Returns an iterator of paired items, overlapping, from the original. When the input iterable has a finite number of items n, the outputted iterable will have n - 1 items.

Returns a 2-tuple of arrays. Splits the elements in the input iterable into either of the two arrays. Will fully exhaust the input iterable. The first array contains all items that match the predicate, the second the rest:

Yields the next item from each iterable in turn, alternating between them. Continues until all items are exhausted.

Non-lazy version of itake().

Yield unique elements, preserving order.

Yields elements in order, ignoring serial duplicates.