Skip to main content
Module

x/ahh/mod.ts>I.filter

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

Creates an Iterator that returns items when f returns true.

Examples

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

const iter = I.filter(I.iter([1, 2, 3, 4]), (i) => i % 2 === 0);

console.log(iter.next()); // 2
console.log(iter.next()); // 4
console.log(iter.next()); // undefined

Parameters

iter: Iterator<T>
f: (_: T) => boolean