Get unlimited public & private packages + package-based permissions with npm Pro.Get started »

apr-until

3.0.3 • Public • Published

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

Install

npm i apr-until

DownloadsWeekly Downloads

0

Version

3.0.3

License

MIT

Last publish

Collaborators

  • avatar