UNPKG

iter-tools-es

Version:
22 lines (18 loc) 478 B
const { asyncIterableCurry } = require('../../internal/async-iterable.js'); async function* __asyncTakeWhile(source, predicate) { let take = true; let c = 0; for await (const value of source) { take = await predicate(value, c++); if (take) { yield value; } else { break; } } } exports.__asyncTakeWhile = __asyncTakeWhile; const asyncTakeWhile = /*#__PURE__*/asyncIterableCurry(__asyncTakeWhile); exports.asyncTakeWhile = asyncTakeWhile;