UNPKG

axax

Version:

A library of async iterator extensions for JavaScript including ```map```, ```reduce```, ```filter```, ```flatMap```, ```pipe``` and [more](https://github.com/jamiemccrindle/axax/blob/master/docs/API.md#functions).

17 lines (16 loc) 387 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * Take while a predicate holds true */ function takeWhile(predicate) { return async function* inner(source) { for await (const item of source) { if (!predicate(item)) { break; } yield item; } }; } exports.takeWhile = takeWhile;