Skip to main content
Module

x/ahh/mod.ts>I.enumerate

Idiomatic type-safety functions.
Go to Latest
method I.enumerate
import { I } from "https://deno.land/x/ahh@v0.10.1/mod.ts";

Creates an Iterator which returns the current iteration as well as the next value.

Examples

import { I } from "./mod.ts";

const iter = I.enumerate(I.iter(["hello", "there", "world"]));

console.log(iter.next()); // [0, "hello"]
console.log(iter.next()); // [1, "there"]
console.log(iter.next()); // [2, "world"]
console.log(iter.next()); // undefined

Returns

Iterator<[number, T]>