@coxy/reply-count-loop
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Register function

const random = () => {
  if (Math.random() > 0.01) {
    throw new Error(':(');
  }
  return 'Success!';
}

Add to loop

import replayCountLoop from '@coxy/reply-count-loop';

const loop = replayCountLoop(random, {
  onError: e => console.log('error', e.message),
  attempts: 20,
  delay: 100,
})

loop.then(console.log);
loop.catch(console.error);

Readme

Keywords

Package Sidebar

Install

npm i @coxy/reply-count-loop

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

3.75 kB

Total Files

8

Last publish

Collaborators

  • dsshard