Utils
With Retry
Simple retry wrapper with exponential backoff.
withRetry
import { } from '@moeru/std/with-retry'
const = async () =>
('https://example.com')
.( => {
if (!.)
throw new (.)
else
return .()
})
const = (, { : 5 })
.(await ())exponential backoff
import { } from '@moeru/std/with-retry'
const = async () =>
('https://example.com')
.( => {
if (!.)
throw new (.)
else
return .()
})
const = (, {
: 5,
: 2, // default value
: 60_000, // enable exponential backoff
})
.(await ())Remarks
If you need more features (such as jitter, signal), you can try foxts/async-retry.
