@isopodlabs/utilities 1.5.2 → 1.5.3
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/iterator.d.ts +2 -2
- package/dist/utils.d.ts +0 -7
- package/dist/utils.js +1 -28
- package/package.json +1 -1
package/dist/iterator.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare function asyncMap<T, U>(iterable: Iterable<T> | undefined, func:
|
|
|
13
13
|
export declare function asyncReduce<T, U>(array: T[], func: (acc: U, v: T, i: number, array: T[]) => Promise<U>, initialValue: U): Promise<U>;
|
|
14
14
|
export declare function parallel(...fns: (() => any)[]): Promise<any[]>;
|
|
15
15
|
export declare function serial(...fns: (() => any)[]): Promise<any[]>;
|
|
16
|
-
export declare function filterIterable<T>(iterable: Iterable<T>, func: (v: T, i: number) =>
|
|
17
|
-
export declare function asyncFilter<T>(iterable: Iterable<T>, func: (v: T) => Promise<
|
|
16
|
+
export declare function filterIterable<T>(iterable: Iterable<T>, func: (v: T, i: number) => unknown): T[];
|
|
17
|
+
export declare function asyncFilter<T>(iterable: Iterable<T>, func: (v: T) => Promise<unknown>): Promise<T[]>;
|
|
18
18
|
export declare function mapObject<T, U>(obj: Record<string, T>, func: (x: [k: string, v: T]) => [k: string, v: U]): Record<string, U>;
|
|
19
19
|
export declare function filterObject<T>(obj: Record<string, T>, func: (x: [k: string, v: T]) => boolean): Record<string, T>;
|
package/dist/utils.d.ts
CHANGED
|
@@ -5,13 +5,6 @@ export declare class Lazy<T> {
|
|
|
5
5
|
get value(): T;
|
|
6
6
|
then<U>(this: T extends Promise<infer R> ? Lazy<T> : never, onFulfilled: (value: T extends Promise<infer R> ? R : never) => U): Promise<U>;
|
|
7
7
|
}
|
|
8
|
-
export declare class AsyncLazy<T> {
|
|
9
|
-
private factory;
|
|
10
|
-
private _value;
|
|
11
|
-
constructor(factory: () => Promise<T>);
|
|
12
|
-
get value(): (T & {}) | null;
|
|
13
|
-
then(fn: (v: T) => void): void;
|
|
14
|
-
}
|
|
15
8
|
export declare class CallCombiner0 {
|
|
16
9
|
private timeout;
|
|
17
10
|
combine(delay: number, func: () => void): void;
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CallCombiner = exports.CallCombiner0 = exports.
|
|
3
|
+
exports.CallCombiner = exports.CallCombiner0 = exports.Lazy = void 0;
|
|
4
4
|
exports.makeCache = makeCache;
|
|
5
5
|
exports.compare = compare;
|
|
6
6
|
exports.reverse_compare = reverse_compare;
|
|
@@ -25,33 +25,6 @@ class Lazy {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
exports.Lazy = Lazy;
|
|
28
|
-
class AsyncLazy {
|
|
29
|
-
factory;
|
|
30
|
-
_value;
|
|
31
|
-
constructor(factory) {
|
|
32
|
-
this.factory = factory;
|
|
33
|
-
}
|
|
34
|
-
get value() {
|
|
35
|
-
if (this._value === undefined) {
|
|
36
|
-
this._value = null;
|
|
37
|
-
this.factory().then(v => this._value = v);
|
|
38
|
-
}
|
|
39
|
-
return this._value;
|
|
40
|
-
}
|
|
41
|
-
then(fn) {
|
|
42
|
-
if (this._value === undefined) {
|
|
43
|
-
this._value = null;
|
|
44
|
-
this.factory().then(v => {
|
|
45
|
-
this._value = v;
|
|
46
|
-
fn(v);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
else if (this._value !== null) {
|
|
50
|
-
fn(this._value);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.AsyncLazy = AsyncLazy;
|
|
55
28
|
class CallCombiner0 {
|
|
56
29
|
timeout = null;
|
|
57
30
|
combine(delay, func) {
|