@hpcc-js/util 2.42.0 → 2.46.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.
Files changed (75) hide show
  1. package/LICENSE +43 -43
  2. package/dist/index.js +2281 -2281
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.min.js +1 -1
  5. package/dist/index.min.js.map +1 -1
  6. package/lib-es6/__package__.js +3 -3
  7. package/lib-es6/__package__.js.map +1 -1
  8. package/lib-es6/array.js +84 -84
  9. package/lib-es6/cache.js +60 -60
  10. package/lib-es6/debounce.js +85 -85
  11. package/lib-es6/dictionary.js +61 -61
  12. package/lib-es6/dispatch.js +101 -101
  13. package/lib-es6/esp.js +32 -32
  14. package/lib-es6/graph.js +348 -348
  15. package/lib-es6/graph2.js +603 -603
  16. package/lib-es6/hashSum.js +49 -49
  17. package/lib-es6/immutable.js +54 -54
  18. package/lib-es6/index.js +21 -21
  19. package/lib-es6/logging.js +177 -177
  20. package/lib-es6/math.js +90 -90
  21. package/lib-es6/object.js +121 -121
  22. package/lib-es6/observer.js +79 -79
  23. package/lib-es6/platform.js +17 -17
  24. package/lib-es6/saxParser.js +125 -125
  25. package/lib-es6/stack.js +41 -41
  26. package/lib-es6/stateful.js +170 -170
  27. package/lib-es6/string.js +22 -22
  28. package/lib-es6/url.js +32 -32
  29. package/package.json +7 -21
  30. package/src/__package__.ts +2 -2
  31. package/src/array.ts +98 -98
  32. package/src/cache.ts +65 -65
  33. package/src/debounce.ts +88 -88
  34. package/src/dictionary.ts +69 -69
  35. package/src/dispatch.ts +119 -119
  36. package/src/esp.ts +32 -32
  37. package/src/graph.ts +353 -353
  38. package/src/graph2.ts +661 -661
  39. package/src/hashSum.ts +55 -55
  40. package/src/immutable.ts +57 -57
  41. package/src/index.ts +21 -21
  42. package/src/logging.ts +211 -211
  43. package/src/math.ts +92 -92
  44. package/src/object.ts +117 -117
  45. package/src/observer.ts +91 -91
  46. package/src/platform.ts +20 -20
  47. package/src/saxParser.ts +135 -135
  48. package/src/stack.ts +41 -41
  49. package/src/stateful.ts +178 -178
  50. package/src/string.ts +21 -21
  51. package/src/url.ts +27 -27
  52. package/types/__package__.d.ts +3 -3
  53. package/types/__package__.d.ts.map +1 -1
  54. package/types/array.d.ts +13 -13
  55. package/types/cache.d.ts +20 -20
  56. package/types/debounce.d.ts +12 -12
  57. package/types/dictionary.d.ts +20 -20
  58. package/types/dispatch.d.ts +26 -26
  59. package/types/esp.d.ts +1 -1
  60. package/types/graph.d.ts +73 -73
  61. package/types/graph2.d.ts +111 -111
  62. package/types/hashSum.d.ts +1 -1
  63. package/types/immutable.d.ts +2 -2
  64. package/types/index.d.ts +21 -21
  65. package/types/logging.d.ts +57 -57
  66. package/types/math.d.ts +70 -70
  67. package/types/object.d.ts +48 -48
  68. package/types/observer.d.ts +18 -18
  69. package/types/platform.d.ts +5 -5
  70. package/types/saxParser.d.ts +28 -28
  71. package/types/stack.d.ts +28 -28
  72. package/types/stateful.d.ts +33 -33
  73. package/types/string.d.ts +2 -2
  74. package/types/url.d.ts +2 -2
  75. package/types-3.4/__package__.d.ts +2 -2
package/src/stateful.ts CHANGED
@@ -1,178 +1,178 @@
1
- import { Dispatch, IObserverHandle, Message } from "./dispatch";
2
- import { deepEquals } from "./immutable";
3
-
4
- class PropChangedMessage extends Message {
5
-
6
- constructor(readonly property: string, public newValue: any, public oldValue?: any) {
7
- super();
8
- }
9
-
10
- get canConflate(): boolean { return true; }
11
- conflate(other: PropChangedMessage) {
12
- if (this.property === other.property) {
13
- this.newValue = other.newValue;
14
- return true;
15
- }
16
- return false;
17
- }
18
-
19
- void(): boolean {
20
- return deepEquals(this.newValue, this.oldValue);
21
- }
22
- }
23
-
24
- export interface IEvent {
25
- id: string;
26
- oldValue: any;
27
- newValue: any;
28
- }
29
-
30
- export type StatePropCallback = (changes: IEvent) => void;
31
- export type StateCallback = (changes: IEvent[]) => void;
32
- export type StateEvents = "propChanged" | "changed";
33
- export class StateObject<U, I> {
34
- private _espState: Partial<U> = {} as U;
35
- private _dispatch = new Dispatch();
36
- private _monitorHandle?: number;
37
- protected _monitorTickCount: number = 0;
38
-
39
- protected clear(newVals?: Partial<I>) {
40
- this._espState = {} as U;
41
- if (newVals !== void 0) {
42
- this.set(newVals as I);
43
- }
44
- this._monitorTickCount = 0;
45
- }
46
-
47
- protected get(): U;
48
- protected get<K extends keyof U>(key: K, defValue?: U[K]): U[K];
49
- protected get<K extends keyof U>(key?: K, defValue?: U[K]): Partial<U> | U[K] | undefined {
50
- if (key === void 0) {
51
- return this._espState;
52
- }
53
- return this.has(key) ? this._espState[key] : defValue;
54
- }
55
-
56
- protected set(newVals: I): void;
57
- protected set<K extends keyof U>(key: K, newVal: U[K], batchMode?: boolean): void;
58
- protected set<K extends keyof U>(keyOrNewVals: K | U, newVal?: U[K]): void {
59
- if (typeof keyOrNewVals === "string") {
60
- return this.setSingle(keyOrNewVals as any, newVal as U[K]); // TODO: "as any" should not be needed (TS >= 3.1.x)
61
- }
62
- this.setAll(keyOrNewVals as Partial<U>);
63
- }
64
-
65
- private setSingle<K extends keyof U>(key: K, newVal: U[K] | undefined): void {
66
- const oldVal = this._espState[key];
67
- this._espState[key] = newVal;
68
- this._dispatch.post(new PropChangedMessage(key as string, newVal, oldVal));
69
- }
70
-
71
- private setAll(_: Partial<U>): void {
72
- for (const key in _) {
73
- if (_.hasOwnProperty(key)) {
74
- this.setSingle(key, _[key]);
75
- }
76
- }
77
- }
78
-
79
- protected has<K extends keyof U>(key: K): boolean {
80
- return this._espState[key] !== void 0;
81
- }
82
-
83
- addObserver(eventID: StateEvents, callback: StateCallback): IObserverHandle;
84
- addObserver(eventID: StateEvents, propID: keyof U, callback: StatePropCallback): IObserverHandle;
85
- addObserver(eventID: StateEvents, propIDOrCallback: StateCallback | keyof U, callback?: StatePropCallback): IObserverHandle {
86
- if (this.isCallback(propIDOrCallback)) {
87
- if (eventID !== "changed") throw new Error("Invalid eventID: " + eventID);
88
- return this._dispatch.attach((messages: PropChangedMessage[]) => {
89
- propIDOrCallback(messages.map(m => ({
90
- id: m.property,
91
- oldValue: m.oldValue,
92
- newValue: m.newValue
93
- })));
94
- });
95
- } else {
96
- if (eventID !== "propChanged") throw new Error("Invalid eventID: " + eventID);
97
- return this._dispatch.attach((messages: PropChangedMessage[]) => {
98
- const filteredMessages = messages.filter(m => m.property === propIDOrCallback);
99
- if (filteredMessages.length) {
100
- if (filteredMessages.length > 1) {
101
- console.warn("Should only be 1 message?");
102
- }
103
- const event = filteredMessages[filteredMessages.length - 1];
104
- callback!({
105
- id: event.property,
106
- oldValue: event.oldValue,
107
- newValue: event.newValue
108
- });
109
- }
110
- });
111
- }
112
- }
113
-
114
- on(eventID: StateEvents, callback: StateCallback): this;
115
- on(eventID: StateEvents, propID: keyof U, callback: StatePropCallback): this;
116
- on(eventID: StateEvents, propIDOrCallback: StateCallback | keyof U, callback?: StatePropCallback): this {
117
- this.addObserver(eventID, propIDOrCallback as any, callback as any);
118
- return this;
119
- }
120
-
121
- protected isCallback(propIDOrCallback: StateCallback | keyof U): propIDOrCallback is StateCallback {
122
- return (typeof propIDOrCallback === "function");
123
- }
124
-
125
- protected hasEventListener(): boolean {
126
- return this._dispatch.hasObserver();
127
- }
128
-
129
- // Monitoring ---
130
- protected async refresh(full: boolean = false): Promise<this> {
131
- await Promise.resolve();
132
- return this;
133
- }
134
-
135
- protected _monitor(): void {
136
- if (this._monitorHandle) {
137
- this._monitorTickCount = 0;
138
- return;
139
- }
140
-
141
- this._monitorHandle = setTimeout(() => {
142
- const refreshPromise: Promise<any> = this.hasEventListener() ? this.refresh() : Promise.resolve();
143
- refreshPromise.then(() => {
144
- this._monitor();
145
- });
146
- delete this._monitorHandle;
147
- }, this._monitorTimeoutDuraction());
148
- }
149
-
150
- protected _monitorTimeoutDuraction(): number {
151
- ++this._monitorTickCount;
152
- if (this._monitorTickCount <= 1) { // Once
153
- return 0;
154
- }
155
- return 30000;
156
- }
157
-
158
- watch(callback: StateCallback, triggerChange: boolean = true): IObserverHandle {
159
- if (typeof callback !== "function") {
160
- throw new Error("Invalid Callback");
161
- }
162
- if (triggerChange) {
163
- setTimeout(() => {
164
- const props: any = this.get();
165
- const changes: IEvent[] = [];
166
- for (const key in props) {
167
- if (props.hasOwnProperty(props)) {
168
- changes.push({ id: key, newValue: props[key], oldValue: undefined });
169
- }
170
- }
171
- callback(changes);
172
- }, 0);
173
- }
174
- const retVal = this.addObserver("changed", callback);
175
- this._monitor();
176
- return retVal;
177
- }
178
- }
1
+ import { Dispatch, IObserverHandle, Message } from "./dispatch";
2
+ import { deepEquals } from "./immutable";
3
+
4
+ class PropChangedMessage extends Message {
5
+
6
+ constructor(readonly property: string, public newValue: any, public oldValue?: any) {
7
+ super();
8
+ }
9
+
10
+ get canConflate(): boolean { return true; }
11
+ conflate(other: PropChangedMessage) {
12
+ if (this.property === other.property) {
13
+ this.newValue = other.newValue;
14
+ return true;
15
+ }
16
+ return false;
17
+ }
18
+
19
+ void(): boolean {
20
+ return deepEquals(this.newValue, this.oldValue);
21
+ }
22
+ }
23
+
24
+ export interface IEvent {
25
+ id: string;
26
+ oldValue: any;
27
+ newValue: any;
28
+ }
29
+
30
+ export type StatePropCallback = (changes: IEvent) => void;
31
+ export type StateCallback = (changes: IEvent[]) => void;
32
+ export type StateEvents = "propChanged" | "changed";
33
+ export class StateObject<U, I> {
34
+ private _espState: Partial<U> = {} as U;
35
+ private _dispatch = new Dispatch();
36
+ private _monitorHandle?: number;
37
+ protected _monitorTickCount: number = 0;
38
+
39
+ protected clear(newVals?: Partial<I>) {
40
+ this._espState = {} as U;
41
+ if (newVals !== void 0) {
42
+ this.set(newVals as I);
43
+ }
44
+ this._monitorTickCount = 0;
45
+ }
46
+
47
+ protected get(): U;
48
+ protected get<K extends keyof U>(key: K, defValue?: U[K]): U[K];
49
+ protected get<K extends keyof U>(key?: K, defValue?: U[K]): Partial<U> | U[K] | undefined {
50
+ if (key === void 0) {
51
+ return this._espState;
52
+ }
53
+ return this.has(key) ? this._espState[key] : defValue;
54
+ }
55
+
56
+ protected set(newVals: I): void;
57
+ protected set<K extends keyof U>(key: K, newVal: U[K], batchMode?: boolean): void;
58
+ protected set<K extends keyof U>(keyOrNewVals: K | U, newVal?: U[K]): void {
59
+ if (typeof keyOrNewVals === "string") {
60
+ return this.setSingle(keyOrNewVals as any, newVal as U[K]); // TODO: "as any" should not be needed (TS >= 3.1.x)
61
+ }
62
+ this.setAll(keyOrNewVals as Partial<U>);
63
+ }
64
+
65
+ private setSingle<K extends keyof U>(key: K, newVal: U[K] | undefined): void {
66
+ const oldVal = this._espState[key];
67
+ this._espState[key] = newVal;
68
+ this._dispatch.post(new PropChangedMessage(key as string, newVal, oldVal));
69
+ }
70
+
71
+ private setAll(_: Partial<U>): void {
72
+ for (const key in _) {
73
+ if (_.hasOwnProperty(key)) {
74
+ this.setSingle(key, _[key]);
75
+ }
76
+ }
77
+ }
78
+
79
+ protected has<K extends keyof U>(key: K): boolean {
80
+ return this._espState[key] !== void 0;
81
+ }
82
+
83
+ addObserver(eventID: StateEvents, callback: StateCallback): IObserverHandle;
84
+ addObserver(eventID: StateEvents, propID: keyof U, callback: StatePropCallback): IObserverHandle;
85
+ addObserver(eventID: StateEvents, propIDOrCallback: StateCallback | keyof U, callback?: StatePropCallback): IObserverHandle {
86
+ if (this.isCallback(propIDOrCallback)) {
87
+ if (eventID !== "changed") throw new Error("Invalid eventID: " + eventID);
88
+ return this._dispatch.attach((messages: PropChangedMessage[]) => {
89
+ propIDOrCallback(messages.map(m => ({
90
+ id: m.property,
91
+ oldValue: m.oldValue,
92
+ newValue: m.newValue
93
+ })));
94
+ });
95
+ } else {
96
+ if (eventID !== "propChanged") throw new Error("Invalid eventID: " + eventID);
97
+ return this._dispatch.attach((messages: PropChangedMessage[]) => {
98
+ const filteredMessages = messages.filter(m => m.property === propIDOrCallback);
99
+ if (filteredMessages.length) {
100
+ if (filteredMessages.length > 1) {
101
+ console.warn("Should only be 1 message?");
102
+ }
103
+ const event = filteredMessages[filteredMessages.length - 1];
104
+ callback!({
105
+ id: event.property,
106
+ oldValue: event.oldValue,
107
+ newValue: event.newValue
108
+ });
109
+ }
110
+ });
111
+ }
112
+ }
113
+
114
+ on(eventID: StateEvents, callback: StateCallback): this;
115
+ on(eventID: StateEvents, propID: keyof U, callback: StatePropCallback): this;
116
+ on(eventID: StateEvents, propIDOrCallback: StateCallback | keyof U, callback?: StatePropCallback): this {
117
+ this.addObserver(eventID, propIDOrCallback as any, callback as any);
118
+ return this;
119
+ }
120
+
121
+ protected isCallback(propIDOrCallback: StateCallback | keyof U): propIDOrCallback is StateCallback {
122
+ return (typeof propIDOrCallback === "function");
123
+ }
124
+
125
+ protected hasEventListener(): boolean {
126
+ return this._dispatch.hasObserver();
127
+ }
128
+
129
+ // Monitoring ---
130
+ protected async refresh(full: boolean = false): Promise<this> {
131
+ await Promise.resolve();
132
+ return this;
133
+ }
134
+
135
+ protected _monitor(): void {
136
+ if (this._monitorHandle) {
137
+ this._monitorTickCount = 0;
138
+ return;
139
+ }
140
+
141
+ this._monitorHandle = setTimeout(() => {
142
+ const refreshPromise: Promise<any> = this.hasEventListener() ? this.refresh() : Promise.resolve();
143
+ refreshPromise.then(() => {
144
+ this._monitor();
145
+ });
146
+ delete this._monitorHandle;
147
+ }, this._monitorTimeoutDuraction());
148
+ }
149
+
150
+ protected _monitorTimeoutDuraction(): number {
151
+ ++this._monitorTickCount;
152
+ if (this._monitorTickCount <= 1) { // Once
153
+ return 0;
154
+ }
155
+ return 30000;
156
+ }
157
+
158
+ watch(callback: StateCallback, triggerChange: boolean = true): IObserverHandle {
159
+ if (typeof callback !== "function") {
160
+ throw new Error("Invalid Callback");
161
+ }
162
+ if (triggerChange) {
163
+ setTimeout(() => {
164
+ const props: any = this.get();
165
+ const changes: IEvent[] = [];
166
+ for (const key in props) {
167
+ if (props.hasOwnProperty(props)) {
168
+ changes.push({ id: key, newValue: props[key], oldValue: undefined });
169
+ }
170
+ }
171
+ callback(changes);
172
+ }, 0);
173
+ }
174
+ const retVal = this.addObserver("changed", callback);
175
+ this._monitor();
176
+ return retVal;
177
+ }
178
+ }
package/src/string.ts CHANGED
@@ -1,21 +1,21 @@
1
- export function trim(str: string, char: string): string {
2
- if (typeof char !== "string") return str;
3
- if (char.length === 0) return str;
4
- while (str.indexOf(char) === 0) {
5
- str = str.substring(1);
6
- }
7
- while (endsWith(str, char)) {
8
- str = str.substring(0, str.length - 1);
9
- }
10
- return str;
11
- }
12
-
13
- export function endsWith(origString: string, searchString: string, position?: number) {
14
- const subjectString = origString.toString();
15
- if (typeof position !== "number" || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
16
- position = subjectString.length;
17
- }
18
- position -= searchString.length;
19
- const lastIndex = subjectString.lastIndexOf(searchString, position);
20
- return lastIndex !== -1 && lastIndex === position;
21
- }
1
+ export function trim(str: string, char: string): string {
2
+ if (typeof char !== "string") return str;
3
+ if (char.length === 0) return str;
4
+ while (str.indexOf(char) === 0) {
5
+ str = str.substring(1);
6
+ }
7
+ while (endsWith(str, char)) {
8
+ str = str.substring(0, str.length - 1);
9
+ }
10
+ return str;
11
+ }
12
+
13
+ export function endsWith(origString: string, searchString: string, position?: number) {
14
+ const subjectString = origString.toString();
15
+ if (typeof position !== "number" || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
16
+ position = subjectString.length;
17
+ }
18
+ position -= searchString.length;
19
+ const lastIndex = subjectString.lastIndexOf(searchString, position);
20
+ return lastIndex !== -1 && lastIndex === position;
21
+ }
package/src/url.ts CHANGED
@@ -1,27 +1,27 @@
1
- export function join(...segments: string[]) {
2
- const parts: string[] = segments.reduce((parts, segment) => {
3
- // Remove leading slashes from non-first part.
4
- if (parts.length > 0) {
5
- segment = segment.replace(/^\//, "");
6
- }
7
- // Remove trailing slashes.
8
- segment = segment.replace(/\/$/, "");
9
- return [...parts, ...segment.split("/")];
10
- }, []);
11
- const resultParts = [];
12
- for (const part of parts) {
13
- if (part === ".") {
14
- continue;
15
- }
16
- if (part === "..") {
17
- resultParts.pop();
18
- continue;
19
- }
20
- resultParts.push(part);
21
- }
22
- return resultParts.join("/");
23
- }
24
-
25
- export function dirname(path: string) {
26
- return join(path, "..");
27
- }
1
+ export function join(...segments: string[]) {
2
+ const parts: string[] = segments.reduce((parts, segment) => {
3
+ // Remove leading slashes from non-first part.
4
+ if (parts.length > 0) {
5
+ segment = segment.replace(/^\//, "");
6
+ }
7
+ // Remove trailing slashes.
8
+ segment = segment.replace(/\/$/, "");
9
+ return [...parts, ...segment.split("/")];
10
+ }, []);
11
+ const resultParts = [];
12
+ for (const part of parts) {
13
+ if (part === ".") {
14
+ continue;
15
+ }
16
+ if (part === "..") {
17
+ resultParts.pop();
18
+ continue;
19
+ }
20
+ resultParts.push(part);
21
+ }
22
+ return resultParts.join("/");
23
+ }
24
+
25
+ export function dirname(path: string) {
26
+ return join(path, "..");
27
+ }
@@ -1,4 +1,4 @@
1
- export declare const PKG_NAME = "@hpcc-js/util";
2
- export declare const PKG_VERSION = "2.42.0";
3
- export declare const BUILD_VERSION = "2.97.0";
1
+ export declare const PKG_NAME = "@hpcc-js/util";
2
+ export declare const PKG_VERSION = "2.46.1";
3
+ export declare const BUILD_VERSION = "2.102.1";
4
4
  //# sourceMappingURL=__package__.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"__package__.d.ts","sourceRoot":"","sources":["../src/__package__.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,WAAW,CAAC"}
1
+ {"version":3,"file":"__package__.d.ts","sourceRoot":"","sources":["../src/__package__.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AACxC,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,aAAa,YAAY,CAAC"}
package/types/array.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export declare function find<T>(o: ReadonlyArray<T>, predicate: (value: T, index: number) => boolean): T | undefined;
2
- export interface IDifferences2<T> {
3
- update: T[];
4
- exit: T[];
5
- enter: T[];
6
- }
7
- export declare function compare<T>(before: readonly T[], after: readonly T[]): IDifferences2<T>;
8
- export interface IDifferences2<T> {
9
- enter: T[];
10
- update: T[];
11
- exit: T[];
12
- }
13
- export declare function compare2<T>(before: readonly T[], after: readonly T[], idFunc: (itme: T) => string | number, updateFunc?: (before: T, after: T) => T): IDifferences2<T>;
1
+ export declare function find<T>(o: ReadonlyArray<T>, predicate: (value: T, index: number) => boolean): T | undefined;
2
+ export interface IDifferences2<T> {
3
+ update: T[];
4
+ exit: T[];
5
+ enter: T[];
6
+ }
7
+ export declare function compare<T>(before: readonly T[], after: readonly T[]): IDifferences2<T>;
8
+ export interface IDifferences2<T> {
9
+ enter: T[];
10
+ update: T[];
11
+ exit: T[];
12
+ }
13
+ export declare function compare2<T>(before: readonly T[], after: readonly T[], idFunc: (itme: T) => string | number, updateFunc?: (before: T, after: T) => T): IDifferences2<T>;
14
14
  //# sourceMappingURL=array.d.ts.map
package/types/cache.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- export declare class Cache<I, C> {
2
- private _cache;
3
- private _calcID;
4
- static hash(...args: any[]): string;
5
- constructor(calcID: (espObj: I | C) => string);
6
- has(espObj: I): boolean;
7
- set(obj: C): C;
8
- get(espObj: I): C | null;
9
- get(espObj: I, factory: () => C): C;
10
- }
11
- export declare class AsyncCache<I, C> {
12
- private _cache;
13
- private _calcID;
14
- static hash(...args: any[]): string;
15
- constructor(calcID: (espObj: I | C) => string);
16
- has(espObj: I): boolean;
17
- set(espObj: I, obj: Promise<C>): Promise<C>;
18
- get(espObj: I): Promise<C | null>;
19
- get(espObj: I, factory: () => Promise<C>): Promise<C>;
20
- }
1
+ export declare class Cache<I, C> {
2
+ private _cache;
3
+ private _calcID;
4
+ static hash(...args: any[]): string;
5
+ constructor(calcID: (espObj: I | C) => string);
6
+ has(espObj: I): boolean;
7
+ set(obj: C): C;
8
+ get(espObj: I): C | null;
9
+ get(espObj: I, factory: () => C): C;
10
+ }
11
+ export declare class AsyncCache<I, C> {
12
+ private _cache;
13
+ private _calcID;
14
+ static hash(...args: any[]): string;
15
+ constructor(calcID: (espObj: I | C) => string);
16
+ has(espObj: I): boolean;
17
+ set(espObj: I, obj: Promise<C>): Promise<C>;
18
+ get(espObj: I): Promise<C | null>;
19
+ get(espObj: I, factory: () => Promise<C>): Promise<C>;
20
+ }
21
21
  //# sourceMappingURL=cache.d.ts.map
@@ -1,13 +1,13 @@
1
- export declare function debounce<R extends Promise<any>>(fn: () => R, timeout?: number): () => R;
2
- export declare function debounce<P1, R extends Promise<any>>(fn: (param1: P1) => R, timeout?: number): (param1: P1) => R;
3
- export declare function debounce<P1, P2, R extends Promise<any>>(fn: (param1: P1, param2: P2) => R, timeout?: number): (param1: P1, param2: P2) => R;
4
- export declare function debounce<P1, P2, P3, R extends Promise<any>>(fn: (param1: P1, param2: P2, param3: P3) => R, timeout?: number): (param1: P1, param2: P2, param3: P3) => R;
5
- export declare function debounce<P1, P2, P3, P4, R extends Promise<any>>(fn: (param1: P1, param2: P2, param3: P3, param4: P4) => R, timeout?: number): (param1: P1, param2: P2, param3: P3, param4: P4) => R;
6
- export declare function promiseTimeout<T>(ms: number, promise: Promise<T>): Promise<T>;
7
- export declare class AsyncOrderedQueue {
8
- private _q;
9
- private isTop;
10
- push<T>(p: Promise<T>): Promise<T>;
11
- }
12
- export declare function sleep(ms: number): Promise<void>;
1
+ export declare function debounce<R extends Promise<any>>(fn: () => R, timeout?: number): () => R;
2
+ export declare function debounce<P1, R extends Promise<any>>(fn: (param1: P1) => R, timeout?: number): (param1: P1) => R;
3
+ export declare function debounce<P1, P2, R extends Promise<any>>(fn: (param1: P1, param2: P2) => R, timeout?: number): (param1: P1, param2: P2) => R;
4
+ export declare function debounce<P1, P2, P3, R extends Promise<any>>(fn: (param1: P1, param2: P2, param3: P3) => R, timeout?: number): (param1: P1, param2: P2, param3: P3) => R;
5
+ export declare function debounce<P1, P2, P3, P4, R extends Promise<any>>(fn: (param1: P1, param2: P2, param3: P3, param4: P4) => R, timeout?: number): (param1: P1, param2: P2, param3: P3, param4: P4) => R;
6
+ export declare function promiseTimeout<T>(ms: number, promise: Promise<T>): Promise<T>;
7
+ export declare class AsyncOrderedQueue {
8
+ private _q;
9
+ private isTop;
10
+ push<T>(p: Promise<T>): Promise<T>;
11
+ }
12
+ export declare function sleep(ms: number): Promise<void>;
13
13
  //# sourceMappingURL=debounce.d.ts.map
@@ -1,21 +1,21 @@
1
- export declare type StringAnyMap = {
2
- [key: string]: any;
3
- };
4
- export declare class Dictionary<T> {
5
- private store;
6
- constructor(attrs?: StringAnyMap);
7
- set(key: string, value: T): T;
8
- get(key: string): T;
9
- has(key: string): boolean;
10
- remove(key: string): void;
11
- keys(): string[];
12
- values(): T[];
13
- }
14
- export declare class DictionaryNoCase<T> extends Dictionary<T> {
15
- constructor(attrs?: StringAnyMap);
16
- set(key: string, value: T): T;
17
- get(key: string): T;
18
- has(key: string): boolean;
19
- remove(key: string): void;
20
- }
1
+ export declare type StringAnyMap = {
2
+ [key: string]: any;
3
+ };
4
+ export declare class Dictionary<T> {
5
+ private store;
6
+ constructor(attrs?: StringAnyMap);
7
+ set(key: string, value: T): T;
8
+ get(key: string): T;
9
+ has(key: string): boolean;
10
+ remove(key: string): void;
11
+ keys(): string[];
12
+ values(): T[];
13
+ }
14
+ export declare class DictionaryNoCase<T> extends Dictionary<T> {
15
+ constructor(attrs?: StringAnyMap);
16
+ set(key: string, value: T): T;
17
+ get(key: string): T;
18
+ has(key: string): boolean;
19
+ remove(key: string): void;
20
+ }
21
21
  //# sourceMappingURL=dictionary.d.ts.map