@augment-vir/common
Advanced tools
Comparing version 21.4.0 to 21.5.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.callAsynchronously = exports.wrapPromiseInTimeout = exports.PromiseTimeoutError = exports.isPromiseLike = void 0; | ||
exports.executeWithRetries = exports.callAsynchronously = exports.wrapPromiseInTimeout = exports.PromiseTimeoutError = exports.isPromiseLike = void 0; | ||
const typed_has_property_1 = require("../object/typed-has-property"); | ||
@@ -51,1 +51,15 @@ function isPromiseLike(input) { | ||
exports.callAsynchronously = callAsynchronously; | ||
async function executeWithRetries(retryCount, callback) { | ||
let currentRetry = 0; | ||
while (currentRetry < retryCount) { | ||
try { | ||
const result = await callback(); | ||
return result; | ||
} | ||
catch (error) { | ||
currentRetry++; | ||
} | ||
} | ||
throw new Error('Retry max reached.'); | ||
} | ||
exports.executeWithRetries = executeWithRetries; |
@@ -44,1 +44,14 @@ import { typedHasProperty } from '../object/typed-has-property'; | ||
} | ||
export async function executeWithRetries(retryCount, callback) { | ||
let currentRetry = 0; | ||
while (currentRetry < retryCount) { | ||
try { | ||
const result = await callback(); | ||
return result; | ||
} | ||
catch (error) { | ||
currentRetry++; | ||
} | ||
} | ||
throw new Error('Retry max reached.'); | ||
} |
@@ -15,1 +15,2 @@ export declare function isPromiseLike<T>(input: T | unknown): input is T extends PromiseLike<infer ValueType> ? PromiseLike<ValueType> : PromiseLike<unknown>; | ||
export declare function callAsynchronously<T>(callback: () => MaybePromise<T>): Promise<T>; | ||
export declare function executeWithRetries<T>(retryCount: number, callback: () => T): Promise<T>; |
{ | ||
"name": "@augment-vir/common", | ||
"version": "21.4.0", | ||
"version": "21.5.0", | ||
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -5,0 +5,0 @@ "bugs": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174702
4234