Skip to main content
Module

x/iterators/mod.ts>zipLongest

Iterators and related functions for Deno. Similar to Python's itertools module. Unlicensed, do what you want.
Latest
function zipLongest
import { zipLongest } from "https://deno.land/x/iterators@v0.2.0/mod.ts";

Yield items from the same index in each iterable, as a tuple. The fill value is used in place of a value from an exhausted iterable.

Examples

Example 1

[...zipLongest(null, [1, 2], [1, 2, 3])]
// => [[1, 1], [2, 2], [null, 3]]

Type Parameters

Fill
Iterables extends Iterable<unknown>[]

Parameters

fill: Fill

The value to use when no value has been generated.

...iterables: Iterables

Iterables to zip together.

Returns

Generator<[I in keyof Iterables]: Unwrap<Iterables[I]> | Fill>