Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/itertools/mod.ts>first

🦕 A TypeScript port of Python's itertools and more-itertools for Deno
Go to Latest
function first
import { first } from "https://deno.land/x/itertools@v1.1.1/mod.ts";

Returns the first item in the iterable for which the predicate holds, if any. If no such item exists, undefined is returned. The default predicate is any defined value.

Parameters

iterable: Iterable<T>
optional
keyFn: Predicate<T>

Returns

Maybe<T>