@mebsly/retry
v1.0.12
Published
A flexible and configurable retry mechanism for JavaScript functions and fetch requests with exponential delay
Maintainers
Readme
Lightweight retry for JavaScript and fetch requests with exponential delay. Usage: https://github.com/mebsly/retry
const retry = require('@mebsly/retry');
// Retry a function
retry(() => someFunction());
// Retry with custom options
retry(() => someFunction(), {
retries: 5,
delay: 1000,
maxDelay: 5000,
shouldRetry: (err) => err.code === 'ECONNRESET'
});