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

x/iter/mod.ts>concat

A bunch of utilities for working with iterables, many inspired by the native array methods.
Latest
function concat
import { concat } from "https://deno.land/x/iter@v3.2.3/mod.ts";

Combines two or more iterables.

Examples

Example 1

import * as iter from "https://deno.land/x/iter/mod.ts";

const concatenated = iter.concat([1, 2, 3], [4, 5, 6]);

for (num of concatenated) {
  console.log(num);
}

// -> 1
// -> 2
// -> 3
// -> 4
// -> 5
// -> 6

Type Parameters

T
optional
U = T

Parameters

head: Iterable<T>
  • The first iterable.
...tails: Array<Iterable<U>>
  • (blob) Additional iterables to add to the end of head. If there are more than one, they must be of the same type.

Returns

An iterable which yields items from the head followed by items from the tail(s) in order.