Skip to main content
Module

x/ahh/mod.ts>Iterator#intersperse

Opinionated idiomatic features for TypeScript.
Go to Latest
method Iterator.prototype.intersperse
import { Iterator } from "https://deno.land/x/ahh@v0.13.0/mod.ts";

Creates an Iterator that yields items from this and other interspersedly.

Examples

Example 1

import { assert } from "../test_deps.ts";
import I from "./iterator.ts";

const iter = I.fromIter([1, 3, 5]).intersperse(I.fromIter([2, 4]));

assert(iter.next() === 1);
assert(iter.next() === 2);
assert(iter.next() === 3);
assert(iter.next() === 4);
assert(iter.next() === 5);