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

x/itertools/mod.ts>flatten

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

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

[...flatten([[0, 1], [2, 3]])]
// [0, 1, 2, 3]

Parameters

iterableOfIterables: Iterable<Iterable<T>>

Returns

Iterable<T>