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

x/iter/lib/transformers.ts

A bunch of utilities for working with iterables, many inspired by the native array methods.
Latest
import * as iter from "https://deno.land/x/iter@v3.2.3/lib/transformers.ts";

Functions

Splits an iterable into evenly sized chunks. See @sindresorhus/chunkify

Lazily flattens a nested iterable completely, such that none of its yielded values are iterable.

Returns a new iterable containing the items of it except the first n items.

Returns a new iterable which skips items from it until f returns true. true.

Returns a new iterable which skips items from it while f returns true. true.

Returns the items of an iterable that meet the condition specified in a callback function.

Lazily flattens a nested iterable to a given depth. Similar to Array.prototype.flat

Lazily calls a defined callback function for each element of an iterable, and returns a new flattened iterable of the results by one level.

Strips and fuses an iterable, such that any results including and after a result with { done: true } are ignored. In the current implementation of most functions, both of these behaviours already happen, so generally this is only necessary when it is the only operation being applied.

Converts an iterable into a series of pairs of indices and values. Similar to Array.prototype.entries or rust's iter.enumerate().

Lazily calls a defined callback function for each element of an iterable, and returns a new iterable of the results.

Generates a peekable iterator from the provided iterable (See Peekable). Note that unlike other transformers, this returns an extended IterableIterator rather than an iterable. Inspired by Rust's std::iter::Peekable.

Makes an iterable remember. Each time it is iterated over it will yield the same results.

Returns a new iterable containing the first n items of it.

Returns a new iterable which yields while f returns true.

Returns a new iterable which yields until f returns true.