Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/ahh/src/iterator.ts>Peekable#nextIf

Opinionated idiomatic features for TypeScript.
Go to Latest
method Peekable.prototype.nextIf
import { Peekable } from "https://deno.land/x/ahh@v0.12.4/src/iterator.ts";

Returns the next item if fn returns true.

Examples

Example 1

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

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

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

Parameters

fn: (_: T) => boolean