"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.retryOnReject = retryOnReject;
function retryOnReject(f, maxRetries, baseDelayMs = 50) {
    let retries = 0;
    const g = async () => {
        try {
            return await f();
        }
        catch (err) {
            if (retries < maxRetries) {
                const delay = baseDelayMs * Math.pow(2, retries);
                await new Promise((resolve) => setTimeout(resolve, delay));
                retries++;
                return g();
            }
            else {
                throw err;
            }
        }
    };
    return g();
}
//# sourceMappingURL=AsyncRetry.js.map