Skip to main content
Module

x/ahh/mod.ts>I.nth

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

Consumes an Iterator up to n and returns the item.

Examples

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

const iter = I.iter([1, 2, 3]);

console.log(I.nth(iter, 1)); // 2
console.log(iter.next()); // 3
console.log(iter.next()); // undefined

Parameters

iter: Iterator<T>
n: number