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

x/itertools/custom.ts

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

Functions

See icompact().

Removes all undefined values from the given object. Returns a new object.

Returns the first item in the iterable for which the predicate holds, if any. If no such item exists, undefined is returned. The default predicate is any defined value.

Returns 0 or more values for every value in the given iterable. Technically, it's just calling map(), followed by flatten(), but it's a very useful operation if you want to map over a structure, but not have a 1:1 input-output mapping. Instead, if you want to potentially return 0 or more values per input element, use flatmap():

Returns an iterable, filtering out any undefined values from the input iterable. This function is useful to convert a list of Maybe<T>'s to a list of T's, discarding all the undefined values: