apr-until
v3.0.3
Published
Repeatedly call fn until test returns true.
Downloads
86
Maintainers
Readme
until
Repeatedly call fn
until test
returns true
.
Parameters
Examples
import until from 'apr-until';
const then = (v) => new Promise((resolve) => resolve(v));
const maxCalls = 10;
let calls = 0;
const output = await until(async () => {
await then();
return (calls += 1) >= maxCalls;
}, async () => (
await then(calls)
);
// output = 10
Returns Promise