retry-utils
Version:
retry-utils is a lightweight and intuitive module that provides a simple yet powerful retry mechanism for your applications.
12 lines (11 loc) • 407 B
TypeScript
export interface RetryOptions {
attempts?: number;
delayMs?: number;
}
/**
* Retry any async function until it returns a meaningful value till number of attempts
* @param {function} op - async function
* @param {RetryOptions} options retry options
* @returns Promise<result | undefined>
*/
export declare function retry<T>(op: () => Promise<T>, options?: RetryOptions): Promise<T | undefined>;