atmpt

1.0.3 • Public • Published

atmpt Build Status

provides an easy way to make promises retry based on exceptions

install

npm install atmpt

options

  • delay (can be a number or function that returns a number, if its a function it gets called with an attempt argument)
  • maxAttempts (the maximum amount of attempts)

examples

heres a basic retry example

await atmpt(async attempt => {
    /* logic */
});

and heres a little more advanced example with validation and custom delays

await atmpt(async attempt => {
    /* logic */
}, {maxAttempts: 10, delay: attempt => attempt * 1000});

Readme

Keywords

none

Package Sidebar

Install

npm i atmpt

Weekly Downloads

40

Version

1.0.3

License

MIT

Unpacked Size

7.01 kB

Total Files

9

Last publish

Collaborators

  • icodeforlove