@neovici/cosmoz-utils 6.11.0 → 6.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/promise.d.ts CHANGED
@@ -9,4 +9,5 @@ export declare const event$: <E extends Event, P extends Predicate<E> = Predicat
9
9
  export declare const limit$: <T extends unknown[], P>(fn: (...args: T) => PromiseLike<P>, limit: number) => (...args: T) => Promise<P>;
10
10
  export declare const debounce$: <T extends unknown[], P>(fn: (...args: T) => P | PromiseLike<P>, ms?: number) => (...args: T) => Promise<P>;
11
11
  export declare const log$: <T extends unknown[], P>(fn: (...args: T) => PromiseLike<P>) => (...args: T) => PromiseLike<P>;
12
+ export declare const retry$: <T extends unknown[], P>(fn: (...args: T) => P | PromiseLike<P>, n: number) => (...args: T) => Promise<P>;
12
13
  export {};
package/dist/promise.js CHANGED
@@ -70,3 +70,17 @@ export const log$ = (fn) => (...args) => fn(...args).then((response) => {
70
70
  console.log(response);
71
71
  return response;
72
72
  });
73
+ export const retry$ = (fn, n) => async (...args) => {
74
+ let r = 0;
75
+ let error;
76
+ while (r < n) {
77
+ try {
78
+ return await fn(...args);
79
+ }
80
+ catch (e) {
81
+ error = e;
82
+ r++;
83
+ }
84
+ }
85
+ throw error;
86
+ };
package/dist/tagged.js CHANGED
@@ -1 +1 @@
1
- export const tagged = (strings, ...values) => strings.flatMap((s, i) => [s, values[i] || '']).join('');
1
+ export const tagged = (strings, ...values) => strings.flatMap((s, i) => [s, values[i] ?? '']).join('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-utils",
3
- "version": "6.11.0",
3
+ "version": "6.12.1",
4
4
  "description": "Date, money and template management functions commonly needed in Cosmoz views.",
5
5
  "keywords": [
6
6
  "polymer",