1.0.3 • Published 6 years ago

atmpt v1.0.3

Weekly downloads
57
License
MIT
Repository
github
Last release
6 years ago

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});