@neovici/cosmoz-utils
Advanced tools
Comparing version 6.11.0 to 6.12.0
@@ -12,2 +12,3 @@ type Pfn<T> = (arg?: T) => void; | ||
export declare const log$: <T extends unknown[], P>(fn: (...args: T) => PromiseLike<P>) => (...args: T) => PromiseLike<P>; | ||
export declare const retry$: <T extends unknown[], P>(fn: (...args: T) => P | PromiseLike<P>, n: number) => (...args: T) => Promise<P>; | ||
export {}; |
@@ -73,1 +73,15 @@ export class ManagedPromise extends Promise { | ||
}); | ||
export const retry$ = (fn, n) => async (...args) => { | ||
let r = 0; | ||
let error; | ||
while (r < n) { | ||
try { | ||
return await fn(...args); | ||
} | ||
catch (e) { | ||
error = e; | ||
r++; | ||
} | ||
} | ||
throw error; | ||
}; |
{ | ||
"name": "@neovici/cosmoz-utils", | ||
"version": "6.11.0", | ||
"version": "6.12.0", | ||
"description": "Date, money and template management functions commonly needed in Cosmoz views.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
109921
2240