Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

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

1

version

3.0.3

license

MIT

homepage

apr.js.org

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability