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

x/itertools/itertools.ts>takewhile

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

Returns an iterator that produces elements from the iterable as long as the predicate is true.

Parameters

iterable: Iterable<T>
predicate: Predicate<T>

Returns

Iterable<T>