Skip to main content
Module

x/ahh/mod.ts>Iterator#find

Opinionated idiomatic type-safety functions.
Go to Latest
method Iterator.prototype.find
import { Iterator } from "https://deno.land/x/ahh@v0.12.0/mod.ts";

Consumes an Iterator until fn returns true and returns the item.

Examples

Example 1

import { default as I } from "./iterator.ts";

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

console.log(iter.find((i) => i % 2 !== 0));

Parameters

fn: (_: T) => boolean