make-retryable
v1.0.1
Published
Makes your function retryable
Downloads
18
Readme
Make Retryable
Makes your function retryable
16 LOC, 100% test coverage, no deps
Installation
npm install make-retryable
Usage
;(async () => {
const makeRetryable = require('make-retryable')
const attempts = 2
const retryable = makeRetryable(fn, attempts /* defauts to 3 */)
// Will retry until the promise resolves or attempts reaches zero
await retryable('https://alz.io')
// Respects input arguments and return values
console.log(await retryable(1, 2, 3) === await retryable(1, 2, 3)) // true
})()