apr-whilst
3.0.3 • Public • Published
whilst
Repeatedly call fn
, while test
returns true.
Parameters
Examples
import whilst from 'apr-whilst';
const then = (v) => new Promise((resolve) => resolve(v));
const maxCalls = 10;
let calls = 0;
const output = await whilst(async () => {
await then();
return (calls += 1) < maxCalls;
}, async () => (
await then(calls)
);
Returns Promise
Package Sidebar
Install
Weekly Downloads