@tspro/ts-utils-lib 1.19.0 → 1.20.0
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/CHANGELOG.md +16 -0
- package/dist/index.d.mts +565 -98
- package/dist/index.d.ts +565 -98
- package/dist/index.js +1793 -222
- package/dist/index.mjs +1782 -222
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -24,39 +24,90 @@ declare namespace index$8 {
|
|
|
24
24
|
|
|
25
25
|
type ErrorConstructor = new (msg: string) => Error;
|
|
26
26
|
declare function setErrorClass(errorClass?: ErrorConstructor): void;
|
|
27
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
28
31
|
declare function interrupt(msg?: string): never;
|
|
29
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
30
36
|
declare function assertEnum<E extends EnumObject>(enumVal: unknown, enumObj: E, name?: string): asserts enumVal is E[keyof E];
|
|
31
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
32
41
|
declare function int(value: unknown, msg?: string): number;
|
|
33
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
34
46
|
declare function eq<T>(value1: T, value2: T, msg?: string): T;
|
|
35
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
36
51
|
declare function int_eq(value: unknown, compareTo: unknown, msg?: string): number;
|
|
37
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
54
|
+
* @private
|
|
55
|
+
*/
|
|
38
56
|
declare function int_lt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
39
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
40
61
|
declare function int_lte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
41
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
64
|
+
* @private
|
|
65
|
+
*/
|
|
42
66
|
declare function int_gt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
43
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
44
71
|
declare function int_gte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
45
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
46
76
|
declare function int_between(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
47
|
-
/**
|
|
77
|
+
/**
|
|
78
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
48
81
|
declare function int_between_exclusive(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
49
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
50
86
|
declare function odd(value: unknown, msg?: string): number;
|
|
51
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
89
|
+
* @private
|
|
90
|
+
*/
|
|
52
91
|
declare function even(value: unknown, msg?: string): number;
|
|
53
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
54
96
|
declare function in_group<T>(value: T, group: ReadonlyArray<T>, msg?: string): T;
|
|
55
|
-
/**
|
|
97
|
+
/**
|
|
98
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
56
101
|
declare function finite(value: unknown, msg?: string): number;
|
|
57
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
104
|
+
* @private
|
|
105
|
+
*/
|
|
58
106
|
declare function array_id<T>(array: Readonly<T[]>, index: unknown, msg?: string): number;
|
|
59
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated - Wil be removed in v2.0.0.
|
|
109
|
+
* @private
|
|
110
|
+
*/
|
|
60
111
|
declare function array_elem<T>(array: Readonly<T[]>, index: number, msg?: string): T;
|
|
61
112
|
declare function assert<T>(condition: T, msg?: string): void;
|
|
62
113
|
declare function require<T>(value: T | null | undefined, msg?: string): T;
|
|
@@ -115,6 +166,7 @@ declare function isEvenNumber$1(value: unknown, msg?: string): value is number;
|
|
|
115
166
|
declare function isIncluded$1<T>(value: T, array: ReadonlyArray<T>, msg?: string): value is T;
|
|
116
167
|
declare function isArrayIndex$1<T>(index: unknown, array: ReadonlyArray<T>, msg?: string): index is number;
|
|
117
168
|
declare function isThrowing$1(throwTestFn: () => void, msg?: string): true;
|
|
169
|
+
declare function isNotThrowing$1(throwTestFn: () => void, msg?: string): true;
|
|
118
170
|
|
|
119
171
|
type index$7_ErrorConstructor = ErrorConstructor;
|
|
120
172
|
declare const index$7_array_elem: typeof array_elem;
|
|
@@ -140,7 +192,7 @@ declare const index$7_require: typeof require;
|
|
|
140
192
|
declare const index$7_requireDefined: typeof requireDefined;
|
|
141
193
|
declare const index$7_setErrorClass: typeof setErrorClass;
|
|
142
194
|
declare namespace index$7 {
|
|
143
|
-
export { type index$7_ErrorConstructor as ErrorConstructor, index$7_array_elem as array_elem, index$7_array_id as array_id, index$7_assert as assert, index$7_assertEnum as assertEnum, index$7_eq as eq, index$7_even as even, index$7_fail as fail, index$7_finite as finite, index$7_in_group as in_group, index$7_int as int, index$7_int_between as int_between, index$7_int_between_exclusive as int_between_exclusive, index$7_int_eq as int_eq, index$7_int_gt as int_gt, index$7_int_gte as int_gte, index$7_int_lt as int_lt, index$7_int_lte as int_lte, index$7_interrupt as interrupt, isArray$1 as isArray, isArrayIndex$1 as isArrayIndex, isArrayOrUndefined$1 as isArrayOrUndefined, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEqual$1 as isEqual, isEvenNumber$1 as isEvenNumber, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, isInfinity$1 as isInfinity, isInteger$1 as isInteger, isIntegerBetween$1 as isIntegerBetween, isIntegerBetweenExclusive$1 as isIntegerBetweenExclusive, isIntegerEq$1 as isIntegerEq, isIntegerGt$1 as isIntegerGt, isIntegerGte$1 as isIntegerGte, isIntegerLt$1 as isIntegerLt, isIntegerLte$1 as isIntegerLte, isIntegerOrUndefined$1 as isIntegerOrUndefined, isNaNValue$1 as isNaNValue, isNegInfinity$1 as isNegInfinity, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberOrUndefined$1 as isNumberOrUndefined, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOddNumber$1 as isOddNumber, isPosInfinity$1 as isPosInfinity, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isThrowing$1 as isThrowing, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, index$7_odd as odd, index$7_require as require, index$7_requireDefined as requireDefined, index$7_setErrorClass as setErrorClass };
|
|
195
|
+
export { type index$7_ErrorConstructor as ErrorConstructor, index$7_array_elem as array_elem, index$7_array_id as array_id, index$7_assert as assert, index$7_assertEnum as assertEnum, index$7_eq as eq, index$7_even as even, index$7_fail as fail, index$7_finite as finite, index$7_in_group as in_group, index$7_int as int, index$7_int_between as int_between, index$7_int_between_exclusive as int_between_exclusive, index$7_int_eq as int_eq, index$7_int_gt as int_gt, index$7_int_gte as int_gte, index$7_int_lt as int_lt, index$7_int_lte as int_lte, index$7_interrupt as interrupt, isArray$1 as isArray, isArrayIndex$1 as isArrayIndex, isArrayOrUndefined$1 as isArrayOrUndefined, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEqual$1 as isEqual, isEvenNumber$1 as isEvenNumber, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, isInfinity$1 as isInfinity, isInteger$1 as isInteger, isIntegerBetween$1 as isIntegerBetween, isIntegerBetweenExclusive$1 as isIntegerBetweenExclusive, isIntegerEq$1 as isIntegerEq, isIntegerGt$1 as isIntegerGt, isIntegerGte$1 as isIntegerGte, isIntegerLt$1 as isIntegerLt, isIntegerLte$1 as isIntegerLte, isIntegerOrUndefined$1 as isIntegerOrUndefined, isNaNValue$1 as isNaNValue, isNegInfinity$1 as isNegInfinity, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNotThrowing$1 as isNotThrowing, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberOrUndefined$1 as isNumberOrUndefined, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOddNumber$1 as isOddNumber, isPosInfinity$1 as isPosInfinity, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isThrowing$1 as isThrowing, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, index$7_odd as odd, index$7_require as require, index$7_requireDefined as requireDefined, index$7_setErrorClass as setErrorClass };
|
|
144
196
|
}
|
|
145
197
|
|
|
146
198
|
/**
|
|
@@ -316,6 +368,7 @@ declare function isEvenNumber(value: unknown): value is number;
|
|
|
316
368
|
declare function isIncluded<T>(value: T, array: ReadonlyArray<T>): value is T;
|
|
317
369
|
declare function isArrayIndex<T>(index: unknown, array: ReadonlyArray<T>): index is number;
|
|
318
370
|
declare function isThrowing(throwTestFn: () => void): boolean;
|
|
371
|
+
declare function isNotThrowing(throwTestFn: () => void): boolean;
|
|
319
372
|
declare function tryOr<TRY_RVAL, OR_RVAL>(tryFn: () => TRY_RVAL, orVal: OR_RVAL | (() => OR_RVAL)): TRY_RVAL | OR_RVAL;
|
|
320
373
|
|
|
321
374
|
type Guard_HasProps<T extends object> = HasProps<T>;
|
|
@@ -355,6 +408,7 @@ declare const Guard_isNonEmptyArray: typeof isNonEmptyArray;
|
|
|
355
408
|
declare const Guard_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
356
409
|
declare const Guard_isNonEmptyString: typeof isNonEmptyString;
|
|
357
410
|
declare const Guard_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
411
|
+
declare const Guard_isNotThrowing: typeof isNotThrowing;
|
|
358
412
|
declare const Guard_isNull: typeof isNull;
|
|
359
413
|
declare const Guard_isNullish: typeof isNullish;
|
|
360
414
|
declare const Guard_isNumber: typeof isNumber;
|
|
@@ -374,13 +428,16 @@ declare const Guard_isTypedObject: typeof isTypedObject;
|
|
|
374
428
|
declare const Guard_isUndefined: typeof isUndefined;
|
|
375
429
|
declare const Guard_tryOr: typeof tryOr;
|
|
376
430
|
declare namespace Guard {
|
|
377
|
-
export { type Guard_HasProps as HasProps, Guard_isArray as isArray, Guard_isArrayIndex as isArrayIndex, Guard_isArrayOrUndefined as isArrayOrUndefined, Guard_isBoolean as isBoolean, Guard_isBooleanOrUndefined as isBooleanOrUndefined, Guard_isDeepEqual as isDeepEqual, Guard_isEmptyArray as isEmptyArray, Guard_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, Guard_isEmptyString as isEmptyString, Guard_isEmptyStringOrUndefined as isEmptyStringOrUndefined, Guard_isEnumValue as isEnumValue, Guard_isEnumValueOrUndefined as isEnumValueOrUndefined, Guard_isEqual as isEqual, Guard_isEvenNumber as isEvenNumber, Guard_isFalse as isFalse, Guard_isFalseOrUndefined as isFalseOrUndefined, Guard_isFinite as isFinite, Guard_isFunction as isFunction, Guard_isFunctionOrUndefined as isFunctionOrUndefined, Guard_isIncluded as isIncluded, Guard_isInfinity as isInfinity, Guard_isInteger as isInteger, Guard_isIntegerBetween as isIntegerBetween, Guard_isIntegerBetweenExclusive as isIntegerBetweenExclusive, Guard_isIntegerEq as isIntegerEq, Guard_isIntegerGt as isIntegerGt, Guard_isIntegerGte as isIntegerGte, Guard_isIntegerLt as isIntegerLt, Guard_isIntegerLte as isIntegerLte, Guard_isIntegerOrUndefined as isIntegerOrUndefined, Guard_isNaNValue as isNaNValue, Guard_isNegInfinity as isNegInfinity, Guard_isNonEmptyArray as isNonEmptyArray, Guard_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, Guard_isNonEmptyString as isNonEmptyString, Guard_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, Guard_isNull as isNull, Guard_isNullish as isNullish, Guard_isNumber as isNumber, Guard_isNumberBetween as isNumberBetween, Guard_isNumberBetweenExclusive as isNumberBetweenExclusive, Guard_isNumberOrUndefined as isNumberOrUndefined, Guard_isObject as isObject, Guard_isObjectOrUndefined as isObjectOrUndefined, Guard_isOddNumber as isOddNumber, Guard_isPosInfinity as isPosInfinity, Guard_isString as isString, Guard_isStringOrUndefined as isStringOrUndefined, Guard_isThrowing as isThrowing, Guard_isTrue as isTrue, Guard_isTrueOrUndefined as isTrueOrUndefined, Guard_isTypedObject as isTypedObject, Guard_isUndefined as isUndefined, Guard_tryOr as tryOr };
|
|
431
|
+
export { type Guard_HasProps as HasProps, Guard_isArray as isArray, Guard_isArrayIndex as isArrayIndex, Guard_isArrayOrUndefined as isArrayOrUndefined, Guard_isBoolean as isBoolean, Guard_isBooleanOrUndefined as isBooleanOrUndefined, Guard_isDeepEqual as isDeepEqual, Guard_isEmptyArray as isEmptyArray, Guard_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, Guard_isEmptyString as isEmptyString, Guard_isEmptyStringOrUndefined as isEmptyStringOrUndefined, Guard_isEnumValue as isEnumValue, Guard_isEnumValueOrUndefined as isEnumValueOrUndefined, Guard_isEqual as isEqual, Guard_isEvenNumber as isEvenNumber, Guard_isFalse as isFalse, Guard_isFalseOrUndefined as isFalseOrUndefined, Guard_isFinite as isFinite, Guard_isFunction as isFunction, Guard_isFunctionOrUndefined as isFunctionOrUndefined, Guard_isIncluded as isIncluded, Guard_isInfinity as isInfinity, Guard_isInteger as isInteger, Guard_isIntegerBetween as isIntegerBetween, Guard_isIntegerBetweenExclusive as isIntegerBetweenExclusive, Guard_isIntegerEq as isIntegerEq, Guard_isIntegerGt as isIntegerGt, Guard_isIntegerGte as isIntegerGte, Guard_isIntegerLt as isIntegerLt, Guard_isIntegerLte as isIntegerLte, Guard_isIntegerOrUndefined as isIntegerOrUndefined, Guard_isNaNValue as isNaNValue, Guard_isNegInfinity as isNegInfinity, Guard_isNonEmptyArray as isNonEmptyArray, Guard_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, Guard_isNonEmptyString as isNonEmptyString, Guard_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, Guard_isNotThrowing as isNotThrowing, Guard_isNull as isNull, Guard_isNullish as isNullish, Guard_isNumber as isNumber, Guard_isNumberBetween as isNumberBetween, Guard_isNumberBetweenExclusive as isNumberBetweenExclusive, Guard_isNumberOrUndefined as isNumberOrUndefined, Guard_isObject as isObject, Guard_isObjectOrUndefined as isObjectOrUndefined, Guard_isOddNumber as isOddNumber, Guard_isPosInfinity as isPosInfinity, Guard_isString as isString, Guard_isStringOrUndefined as isStringOrUndefined, Guard_isThrowing as isThrowing, Guard_isTrue as isTrue, Guard_isTrueOrUndefined as isTrueOrUndefined, Guard_isTypedObject as isTypedObject, Guard_isUndefined as isUndefined, Guard_tryOr as tryOr };
|
|
378
432
|
}
|
|
379
433
|
|
|
380
434
|
declare function toArray<T>(a: T | T[]): Array<T>;
|
|
381
435
|
declare function duplicate<T>(a: T[] | undefined): T[] | undefined;
|
|
382
436
|
declare function removeDuplicates<T>(arr: T[], compareFn?: (a: T, b: T) => boolean): T[];
|
|
383
|
-
/**
|
|
437
|
+
/**
|
|
438
|
+
* @deprecated - Use {@link removeDuplicates} with compareFn instead. Will be removed in v2.0.0.
|
|
439
|
+
* @private
|
|
440
|
+
*/
|
|
384
441
|
declare function removeDuplicatesCmp<T>(arr: ReadonlyArray<T>, compareFn: (t1: T, t2: T) => boolean): T[];
|
|
385
442
|
declare function fillArray<T>(fillValue: T, fillCount: number): T[];
|
|
386
443
|
declare function mapSequenceArray<T>(len: number, fn: (i: number) => T): T[];
|
|
@@ -591,6 +648,7 @@ declare function charCount(str: string, ch: string): number;
|
|
|
591
648
|
* @param PascalString
|
|
592
649
|
*/
|
|
593
650
|
declare function makeSentenceFromPascal(PascalString: string): string;
|
|
651
|
+
declare function stringify(value: any, maxDepth?: number, seen?: WeakSet<WeakKey>): string;
|
|
594
652
|
|
|
595
653
|
declare const index$1_charCount: typeof charCount;
|
|
596
654
|
declare const index$1_chunkString: typeof chunkString;
|
|
@@ -600,13 +658,15 @@ declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
|
|
|
600
658
|
declare const index$1_removeAt: typeof removeAt;
|
|
601
659
|
declare const index$1_repeatString: typeof repeatString;
|
|
602
660
|
declare const index$1_replaceAt: typeof replaceAt;
|
|
661
|
+
declare const index$1_stringify: typeof stringify;
|
|
603
662
|
declare const index$1_toCharArray: typeof toCharArray;
|
|
604
663
|
declare namespace index$1 {
|
|
605
|
-
export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_isString as isString, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_toCharArray as toCharArray };
|
|
664
|
+
export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_isString as isString, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_stringify as stringify, index$1_toCharArray as toCharArray };
|
|
606
665
|
}
|
|
607
666
|
|
|
608
667
|
/**
|
|
609
|
-
* @deprecated Use {@link Guard} instead.
|
|
668
|
+
* @deprecated Use {@link Guard} instead. Will be removed in v2.0.0.
|
|
669
|
+
* @private
|
|
610
670
|
*/
|
|
611
671
|
declare const Is: typeof Guard;
|
|
612
672
|
|
|
@@ -615,11 +675,33 @@ declare namespace index {
|
|
|
615
675
|
export { index$6 as Arr, index$5 as Dom, index$8 as Enum, index_Is as Is, index$4 as Map, index$3 as Math, index$2 as Obj, index$1 as Str };
|
|
616
676
|
}
|
|
617
677
|
|
|
678
|
+
type EqualityFn<V> = (a: V, b: V) => boolean;
|
|
679
|
+
declare const DefaultEqualityFn: EqualityFn<any>;
|
|
680
|
+
interface KVComponent<K extends any[], VALUE> {
|
|
681
|
+
get size(): number;
|
|
682
|
+
isEmpty(): boolean;
|
|
683
|
+
has(...keys: K): boolean;
|
|
684
|
+
get(...keys: K): VALUE | undefined;
|
|
685
|
+
getOrDefault(...keysAndDefault: [...K, VALUE]): VALUE;
|
|
686
|
+
getOrCreate(...keysAndCreator: [...K, VALUE]): VALUE;
|
|
687
|
+
set(...keysAndValue: [...K, VALUE]): void;
|
|
688
|
+
delete(...keys: K): boolean;
|
|
689
|
+
clear?(): void;
|
|
690
|
+
toString(): string;
|
|
691
|
+
kvValues(): IterableIterator<VALUE>;
|
|
692
|
+
kvKeys(): IterableIterator<K>;
|
|
693
|
+
kvEntries(): IterableIterator<[K, VALUE]>;
|
|
694
|
+
}
|
|
695
|
+
declare abstract class BaseContainer {
|
|
696
|
+
abstract toString(): string;
|
|
697
|
+
}
|
|
698
|
+
|
|
618
699
|
/**
|
|
619
700
|
* This is a stack data structure.
|
|
620
701
|
*/
|
|
621
|
-
declare class Stack<T> {
|
|
702
|
+
declare class Stack<T> extends BaseContainer {
|
|
622
703
|
private readonly data;
|
|
704
|
+
constructor();
|
|
623
705
|
private assertId;
|
|
624
706
|
get length(): number;
|
|
625
707
|
push(el: T): T;
|
|
@@ -655,7 +737,7 @@ declare class Stack<T> {
|
|
|
655
737
|
* console.log(a.clone().equals(a)); // true
|
|
656
738
|
* ```
|
|
657
739
|
*/
|
|
658
|
-
declare class Vec {
|
|
740
|
+
declare class Vec extends BaseContainer {
|
|
659
741
|
readonly coords: number[];
|
|
660
742
|
constructor(...coords: number[]);
|
|
661
743
|
static vec2(x: number, y: number): Vec;
|
|
@@ -755,13 +837,25 @@ declare class DivRect {
|
|
|
755
837
|
* @returns - DivRect.
|
|
756
838
|
*/
|
|
757
839
|
static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
|
|
758
|
-
/**
|
|
840
|
+
/**
|
|
841
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
842
|
+
* @private
|
|
843
|
+
* */
|
|
759
844
|
get centerX(): number;
|
|
760
|
-
/**
|
|
845
|
+
/**
|
|
846
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
847
|
+
* @private
|
|
848
|
+
* */
|
|
761
849
|
set centerX(x: number);
|
|
762
|
-
/**
|
|
850
|
+
/**
|
|
851
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
852
|
+
* @private
|
|
853
|
+
* */
|
|
763
854
|
get centerY(): number;
|
|
764
|
-
/**
|
|
855
|
+
/**
|
|
856
|
+
* @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
|
|
857
|
+
* @private
|
|
858
|
+
* */
|
|
765
859
|
set centerY(y: number);
|
|
766
860
|
/**
|
|
767
861
|
* Width getter.
|
|
@@ -839,7 +933,10 @@ declare class DivRect {
|
|
|
839
933
|
* @returns - True/false.
|
|
840
934
|
*/
|
|
841
935
|
equalsEdges(other: DivRect): boolean;
|
|
842
|
-
/**
|
|
936
|
+
/**
|
|
937
|
+
* @deprecated - Use `DivRect.equalsEdges()` instead. Will be removed in v2.0.0.
|
|
938
|
+
* @private
|
|
939
|
+
*/
|
|
843
940
|
static equalsFrame(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
844
941
|
/**
|
|
845
942
|
* Created duplicate of this Rect.
|
|
@@ -917,7 +1014,7 @@ declare class DivRect {
|
|
|
917
1014
|
/**
|
|
918
1015
|
* LRUCache is an implementation of least recently used cache with a fixed capacity.
|
|
919
1016
|
*/
|
|
920
|
-
declare class LRUCache<K extends string, V> {
|
|
1017
|
+
declare class LRUCache<K extends string, V> extends BaseContainer {
|
|
921
1018
|
private cache;
|
|
922
1019
|
private next;
|
|
923
1020
|
private prev;
|
|
@@ -933,29 +1030,18 @@ declare class LRUCache<K extends string, V> {
|
|
|
933
1030
|
private evict;
|
|
934
1031
|
private removeKey;
|
|
935
1032
|
private addToTail;
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
isEmpty(): boolean;
|
|
941
|
-
has(...keys: K): boolean;
|
|
942
|
-
get(...keys: K): VALUE | undefined;
|
|
943
|
-
getOrDefault(...keysAndDefault: [...K, VALUE]): VALUE;
|
|
944
|
-
getOrCreate(...keysAndCreator: [...K, VALUE]): VALUE;
|
|
945
|
-
set(...keysAndValue: [...K, VALUE]): void;
|
|
946
|
-
delete(...keys: K): boolean;
|
|
947
|
-
clear?(): void;
|
|
1033
|
+
keys(): IterableIterator<K>;
|
|
1034
|
+
values(): IterableIterator<V>;
|
|
1035
|
+
entries(): IterableIterator<[K, V]>;
|
|
1036
|
+
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
948
1037
|
toString(): string;
|
|
949
|
-
kvValues(): IterableIterator<VALUE>;
|
|
950
|
-
kvKeys(): IterableIterator<K>;
|
|
951
|
-
kvEntries(): IterableIterator<[K, VALUE]>;
|
|
952
1038
|
}
|
|
953
1039
|
|
|
954
1040
|
/**
|
|
955
1041
|
* `IndexArray` is a sparse array with non-negative indexes. It stores values
|
|
956
1042
|
* to indexes, and each index also has flag telling it has a value.
|
|
957
1043
|
*/
|
|
958
|
-
declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
1044
|
+
declare class IndexArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
|
|
959
1045
|
private static validateIndex;
|
|
960
1046
|
private posVal;
|
|
961
1047
|
private hasPos;
|
|
@@ -1007,7 +1093,7 @@ declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
1007
1093
|
* `IndexArray` is a sparse array with positive and negative indexes. It stores
|
|
1008
1094
|
* values to indexes, and each index also has flag telling it has a value.
|
|
1009
1095
|
*/
|
|
1010
|
-
declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
1096
|
+
declare class SignedIndexArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
|
|
1011
1097
|
private static toNegIndex;
|
|
1012
1098
|
private static validateIndex;
|
|
1013
1099
|
private posVal;
|
|
@@ -1057,56 +1143,116 @@ declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
1057
1143
|
toString(): string;
|
|
1058
1144
|
}
|
|
1059
1145
|
|
|
1146
|
+
/**
|
|
1147
|
+
* `DefaultArray` is an array list where every index is guaranteed to have a value.
|
|
1148
|
+
* There are no undefineds unless that is part of the value type.
|
|
1149
|
+
* When you create `DefaultArray` you give a default value. For example if you
|
|
1150
|
+
* delete an index then that index is set to the default value.
|
|
1151
|
+
*/
|
|
1152
|
+
declare class DefaultArray<VALUE> extends BaseContainer implements KVComponent<[number], VALUE> {
|
|
1153
|
+
private readonly defaultValue;
|
|
1154
|
+
private data;
|
|
1155
|
+
constructor(defaultValue: VALUE);
|
|
1156
|
+
constructor(length: number, defaultValue: VALUE);
|
|
1157
|
+
constructor(values: Iterable<VALUE>, defaultValue: VALUE);
|
|
1158
|
+
get size(): number;
|
|
1159
|
+
get length(): number;
|
|
1160
|
+
private assertId;
|
|
1161
|
+
isEmpty(): boolean;
|
|
1162
|
+
isDefault(id: number): boolean;
|
|
1163
|
+
isSet(id: number): boolean;
|
|
1164
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1165
|
+
has(id: number): boolean;
|
|
1166
|
+
set(id: number, value: VALUE): VALUE;
|
|
1167
|
+
get(id: number): VALUE;
|
|
1168
|
+
getOrDefault(id: number, defaultValue: VALUE): VALUE;
|
|
1169
|
+
getOrCreate(id: number, value: VALUE): VALUE;
|
|
1170
|
+
getOrCreate(id: number, creator: () => VALUE): VALUE;
|
|
1171
|
+
delete(id: number): boolean;
|
|
1172
|
+
clear(empty?: boolean): void;
|
|
1173
|
+
forEach(callbackfn: (value: VALUE, id: number, arr: DefaultArray<VALUE>) => void, thisArg?: any): void;
|
|
1174
|
+
indices(): IterableIterator<number>;
|
|
1175
|
+
values(): IterableIterator<VALUE>;
|
|
1176
|
+
entries(): IterableIterator<[number, VALUE]>;
|
|
1177
|
+
indicesArray(): number[];
|
|
1178
|
+
valuesArray(): VALUE[];
|
|
1179
|
+
entriesArray(): [number, VALUE][];
|
|
1180
|
+
kvKeys(): IterableIterator<[number]>;
|
|
1181
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1182
|
+
kvEntries(): IterableIterator<[[number], VALUE]>;
|
|
1183
|
+
[Symbol.iterator](): IterableIterator<[number, VALUE]>;
|
|
1184
|
+
clone(): DefaultArray<VALUE>;
|
|
1185
|
+
merge(other: DefaultArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
|
|
1186
|
+
some(fn: (value: VALUE, id: number) => boolean): boolean;
|
|
1187
|
+
every(fn: (value: VALUE, key1: number) => boolean): boolean;
|
|
1188
|
+
filter<S extends VALUE>(predicate: (value: VALUE, id: number, array: DefaultArray<VALUE>) => value is S): DefaultArray<S>;
|
|
1189
|
+
filter(predicate: (value: VALUE, id: number, array: DefaultArray<VALUE>) => unknown): DefaultArray<VALUE>;
|
|
1190
|
+
reduce(fn: (acc: VALUE, value: VALUE, id: number) => VALUE): VALUE;
|
|
1191
|
+
reduce<R>(fn: (acc: R, value: VALUE, id: number) => R, init: R): R;
|
|
1192
|
+
mapToArray<R>(fn: (value: VALUE, key1: number) => R): R[];
|
|
1193
|
+
map<R = VALUE>(fn: (value: VALUE, key1: number) => R, defaultValue: R): DefaultArray<R>;
|
|
1194
|
+
equals(other: DefaultArray<VALUE>): boolean;
|
|
1195
|
+
equals(other: DefaultArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
|
|
1196
|
+
toArray(): VALUE[];
|
|
1197
|
+
toString(): string;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1060
1200
|
/**
|
|
1061
1201
|
* A Map implementation mapping a single key to a value.
|
|
1062
1202
|
*/
|
|
1063
|
-
declare class
|
|
1064
|
-
private
|
|
1203
|
+
declare class UniMap<KEY, VALUE> extends BaseContainer implements KVComponent<[KEY], VALUE> {
|
|
1204
|
+
private map;
|
|
1205
|
+
private keyEquals;
|
|
1065
1206
|
constructor();
|
|
1066
|
-
constructor(
|
|
1067
|
-
constructor(
|
|
1068
|
-
|
|
1069
|
-
set
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
delete(
|
|
1207
|
+
constructor(equals?: EqualityFn<KEY>);
|
|
1208
|
+
constructor(list: UniMap<KEY, VALUE> | Iterable<[KEY, VALUE]>, equals?: EqualityFn<KEY>);
|
|
1209
|
+
static createDeep<KEY1, VALUE>(): UniMap<KEY1, VALUE>;
|
|
1210
|
+
static createDeep<KEY1, VALUE>(set: UniMap<KEY1, VALUE>): UniMap<KEY1, VALUE>;
|
|
1211
|
+
static createDeep<KEY1, VALUE>(entries: Iterable<[KEY1, VALUE]>): UniMap<KEY1, VALUE>;
|
|
1212
|
+
has(key: KEY): boolean;
|
|
1213
|
+
set(key: KEY, value: VALUE): VALUE;
|
|
1214
|
+
get(key: KEY): VALUE | undefined;
|
|
1215
|
+
delete(key: KEY): boolean;
|
|
1216
|
+
getOrDefault(key: KEY, defaultValue: VALUE): VALUE;
|
|
1217
|
+
getOrCreate(key: KEY, value: VALUE): VALUE;
|
|
1218
|
+
getOrCreate(key: KEY, creator: () => VALUE): VALUE;
|
|
1075
1219
|
clear(): void;
|
|
1076
1220
|
get size(): number;
|
|
1077
1221
|
isEmpty(): boolean;
|
|
1078
|
-
forEach(callbackfn: (value: VALUE,
|
|
1079
|
-
keys(): IterableIterator<
|
|
1222
|
+
forEach(callbackfn: (value: VALUE, key: KEY, map1: UniMap<KEY, VALUE>) => void, thisArg?: any): void;
|
|
1223
|
+
keys(): IterableIterator<KEY>;
|
|
1080
1224
|
values(): IterableIterator<VALUE>;
|
|
1081
|
-
entries(): IterableIterator<[
|
|
1082
|
-
keysArray():
|
|
1225
|
+
entries(): IterableIterator<[KEY, VALUE]>;
|
|
1226
|
+
keysArray(): KEY[];
|
|
1083
1227
|
valuesArray(): VALUE[];
|
|
1084
|
-
entriesArray(): [
|
|
1085
|
-
kvKeys(): IterableIterator<[
|
|
1228
|
+
entriesArray(): [KEY, VALUE][];
|
|
1229
|
+
kvKeys(): IterableIterator<[KEY]>;
|
|
1086
1230
|
kvValues(): IterableIterator<VALUE>;
|
|
1087
|
-
kvEntries(): IterableIterator<[[
|
|
1088
|
-
[Symbol.iterator](): IterableIterator<[
|
|
1089
|
-
clone():
|
|
1090
|
-
merge(other:
|
|
1091
|
-
some(fn: (value: VALUE,
|
|
1092
|
-
every(fn: (value: VALUE,
|
|
1093
|
-
filter<S extends VALUE>(predicate: (value: VALUE,
|
|
1094
|
-
filter(predicate: (value: VALUE,
|
|
1095
|
-
reduce(fn: (acc: VALUE, value: VALUE,
|
|
1096
|
-
reduce<R>(fn: (acc: R, value: VALUE,
|
|
1097
|
-
mapEntries<R>(fn: (value: VALUE,
|
|
1098
|
-
mapValues<R = VALUE>(fn: (value: VALUE,
|
|
1099
|
-
toMap(): Map<
|
|
1231
|
+
kvEntries(): IterableIterator<[[KEY], VALUE]>;
|
|
1232
|
+
[Symbol.iterator](): IterableIterator<[KEY, VALUE]>;
|
|
1233
|
+
clone(): UniMap<KEY, VALUE>;
|
|
1234
|
+
merge(other: UniMap<KEY, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key: KEY) => VALUE): this;
|
|
1235
|
+
some(fn: (value: VALUE, key: KEY) => boolean): boolean;
|
|
1236
|
+
every(fn: (value: VALUE, key: KEY) => boolean): boolean;
|
|
1237
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key: KEY, array: UniMap<KEY, VALUE>) => value is S): UniMap<KEY, S>;
|
|
1238
|
+
filter(predicate: (value: VALUE, key: KEY, array: UniMap<KEY, VALUE>) => unknown): UniMap<KEY, VALUE>;
|
|
1239
|
+
reduce(fn: (acc: VALUE, value: VALUE, key: KEY) => VALUE): VALUE;
|
|
1240
|
+
reduce<R>(fn: (acc: R, value: VALUE, key: KEY) => R, init: R): R;
|
|
1241
|
+
mapEntries<R>(fn: (value: VALUE, key: KEY) => R): R[];
|
|
1242
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key: KEY) => R): UniMap<KEY, R>;
|
|
1243
|
+
toMap(): Map<KEY, VALUE>;
|
|
1100
1244
|
toString(): string;
|
|
1101
1245
|
}
|
|
1102
1246
|
|
|
1103
1247
|
/**
|
|
1104
1248
|
* A Map implementation mapping a double key to a value.
|
|
1105
1249
|
*/
|
|
1106
|
-
declare class
|
|
1250
|
+
declare class BiMap<KEY1, KEY2, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
1107
1251
|
private map1;
|
|
1252
|
+
private key1Equals;
|
|
1253
|
+
private key2Equals;
|
|
1108
1254
|
constructor();
|
|
1109
|
-
constructor(
|
|
1255
|
+
constructor(biMap: BiMap<KEY1, KEY2, VALUE>);
|
|
1110
1256
|
constructor(entries: Iterable<[KEY1, KEY2, VALUE]>);
|
|
1111
1257
|
has(key1: KEY1, key2: KEY2): boolean;
|
|
1112
1258
|
set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
@@ -1119,7 +1265,7 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
1119
1265
|
clear(): void;
|
|
1120
1266
|
get size(): number;
|
|
1121
1267
|
isEmpty(): boolean;
|
|
1122
|
-
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2:
|
|
1268
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: BiMap<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
|
|
1123
1269
|
keys(): IterableIterator<[KEY1, KEY2]>;
|
|
1124
1270
|
values(): IterableIterator<VALUE>;
|
|
1125
1271
|
entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
@@ -1130,16 +1276,16 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
1130
1276
|
kvValues(): IterableIterator<VALUE>;
|
|
1131
1277
|
kvEntries(): IterableIterator<[[KEY1, KEY2], VALUE]>;
|
|
1132
1278
|
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
1133
|
-
clone():
|
|
1134
|
-
merge(other:
|
|
1279
|
+
clone(): BiMap<KEY1, KEY2, VALUE>;
|
|
1280
|
+
merge(other: BiMap<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
1135
1281
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1136
1282
|
every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1137
|
-
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array:
|
|
1138
|
-
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array:
|
|
1283
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: BiMap<KEY1, KEY2, VALUE>) => value is S): BiMap<KEY1, KEY2, S>;
|
|
1284
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: BiMap<KEY1, KEY2, VALUE>) => unknown): BiMap<KEY1, KEY2, VALUE>;
|
|
1139
1285
|
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2) => VALUE): VALUE;
|
|
1140
1286
|
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
|
|
1141
1287
|
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
|
|
1142
|
-
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R):
|
|
1288
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): BiMap<KEY1, KEY2, R>;
|
|
1143
1289
|
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
1144
1290
|
toString(): string;
|
|
1145
1291
|
}
|
|
@@ -1147,11 +1293,14 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
1147
1293
|
/**
|
|
1148
1294
|
* A Map implementation mapping a triple key to a value.
|
|
1149
1295
|
*/
|
|
1150
|
-
declare class
|
|
1296
|
+
declare class TriMap<KEY1, KEY2, KEY3, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
1151
1297
|
private map1;
|
|
1298
|
+
private key1Equals;
|
|
1299
|
+
private key2Equals;
|
|
1300
|
+
private key3Equals;
|
|
1152
1301
|
constructor();
|
|
1153
1302
|
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
1154
|
-
constructor(
|
|
1303
|
+
constructor(triMap: TriMap<KEY1, KEY2, KEY3, VALUE>);
|
|
1155
1304
|
has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
1156
1305
|
set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
1157
1306
|
get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
|
|
@@ -1164,7 +1313,7 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2,
|
|
|
1164
1313
|
clear(): void;
|
|
1165
1314
|
get size(): number;
|
|
1166
1315
|
isEmpty(): boolean;
|
|
1167
|
-
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2:
|
|
1316
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: TriMap<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
|
|
1168
1317
|
keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
1169
1318
|
values(): IterableIterator<VALUE>;
|
|
1170
1319
|
entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
@@ -1175,24 +1324,76 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2,
|
|
|
1175
1324
|
kvValues(): IterableIterator<VALUE>;
|
|
1176
1325
|
kvEntries(): IterableIterator<[[KEY1, KEY2, KEY3], VALUE]>;
|
|
1177
1326
|
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
1178
|
-
clone():
|
|
1179
|
-
merge(other:
|
|
1327
|
+
clone(): TriMap<KEY1, KEY2, KEY3, VALUE>;
|
|
1328
|
+
merge(other: TriMap<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
1180
1329
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1181
1330
|
every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1182
|
-
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array:
|
|
1183
|
-
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array:
|
|
1331
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: TriMap<KEY1, KEY2, KEY3, VALUE>) => value is S): TriMap<KEY1, KEY2, KEY3, S>;
|
|
1332
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: TriMap<KEY1, KEY2, KEY3, VALUE>) => unknown): TriMap<KEY1, KEY2, KEY3, VALUE>;
|
|
1184
1333
|
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): VALUE;
|
|
1185
1334
|
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
|
|
1186
1335
|
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
|
|
1187
|
-
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R):
|
|
1336
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): TriMap<KEY1, KEY2, KEY3, R>;
|
|
1188
1337
|
toMap(): Map<[KEY1, KEY2, KEY3], VALUE>;
|
|
1189
1338
|
toString(): string;
|
|
1190
1339
|
}
|
|
1191
1340
|
|
|
1341
|
+
/**
|
|
1342
|
+
* An implementation of a Set data structure.
|
|
1343
|
+
*/
|
|
1344
|
+
declare class ValueSet<VALUE> extends BaseContainer implements KVComponent<[VALUE], VALUE> {
|
|
1345
|
+
private data;
|
|
1346
|
+
private equals;
|
|
1347
|
+
constructor();
|
|
1348
|
+
constructor(equals?: EqualityFn<VALUE>);
|
|
1349
|
+
constructor(list: ValueSet<VALUE> | Iterable<VALUE>, equals?: EqualityFn<VALUE>);
|
|
1350
|
+
static createDeep<VALUE>(): ValueSet<VALUE>;
|
|
1351
|
+
static createDeep<VALUE>(set: ValueSet<VALUE>): ValueSet<VALUE>;
|
|
1352
|
+
static createDeep<VALUE>(entries: Iterable<VALUE>): ValueSet<VALUE>;
|
|
1353
|
+
has(value: VALUE): boolean;
|
|
1354
|
+
add(value: VALUE): VALUE;
|
|
1355
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1356
|
+
set(key: VALUE, value: VALUE): void;
|
|
1357
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1358
|
+
get(key: VALUE): VALUE | undefined;
|
|
1359
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1360
|
+
getOrDefault(key: VALUE, defaultValue: VALUE): VALUE;
|
|
1361
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1362
|
+
getOrCreate(key: VALUE, value: VALUE): VALUE;
|
|
1363
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1364
|
+
getOrCreate(key: VALUE, creator: () => VALUE): VALUE;
|
|
1365
|
+
delete(value: VALUE): boolean;
|
|
1366
|
+
clear(): void;
|
|
1367
|
+
get size(): number;
|
|
1368
|
+
isEmpty(): boolean;
|
|
1369
|
+
forEach(callbackfn: (value: VALUE, set: ValueSet<VALUE>) => void, thisArg?: any): void;
|
|
1370
|
+
keys(): IterableIterator<VALUE>;
|
|
1371
|
+
values(): IterableIterator<VALUE>;
|
|
1372
|
+
entries(): IterableIterator<[VALUE, VALUE]>;
|
|
1373
|
+
kvKeys(): IterableIterator<[VALUE]>;
|
|
1374
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1375
|
+
kvEntries(): IterableIterator<[[VALUE], VALUE]>;
|
|
1376
|
+
[Symbol.iterator](): IterableIterator<VALUE>;
|
|
1377
|
+
clone(): ValueSet<VALUE>;
|
|
1378
|
+
merge(other: ValueSet<VALUE>): this;
|
|
1379
|
+
some(fn: (value: VALUE) => boolean): boolean;
|
|
1380
|
+
every(fn: (value: VALUE) => boolean): boolean;
|
|
1381
|
+
filter<R extends VALUE>(predicate: (value: VALUE, set: ValueSet<VALUE>) => value is R): ValueSet<R>;
|
|
1382
|
+
filter(predicate: (value: VALUE, set1: ValueSet<VALUE>) => unknown): ValueSet<VALUE>;
|
|
1383
|
+
reduce(fn: (acc: VALUE, value: VALUE) => VALUE): VALUE;
|
|
1384
|
+
reduce<R = VALUE>(fn: (acc: R, value: VALUE) => R, init: R): R;
|
|
1385
|
+
mapValues<R = VALUE>(fn: (value: VALUE) => R): ValueSet<R>;
|
|
1386
|
+
mapToArray<R = VALUE>(fn: (value: VALUE) => R): R[];
|
|
1387
|
+
map<R = VALUE>(fn: (value: VALUE) => R): ValueSet<R>;
|
|
1388
|
+
toSet(): Set<VALUE>;
|
|
1389
|
+
toArray(): VALUE[];
|
|
1390
|
+
toString(): string;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1192
1393
|
/**
|
|
1193
1394
|
* Wrapper class of a key-value container that contain array values.
|
|
1194
1395
|
*/
|
|
1195
|
-
declare class MultiContainer<K extends any[], V> {
|
|
1396
|
+
declare class MultiContainer<K extends any[], V> extends BaseContainer {
|
|
1196
1397
|
private readonly base;
|
|
1197
1398
|
constructor(base: KVComponent<K, V[]>);
|
|
1198
1399
|
isEmpty(): boolean;
|
|
@@ -1222,10 +1423,61 @@ declare class MultiContainer<K extends any[], V> {
|
|
|
1222
1423
|
*/
|
|
1223
1424
|
declare function asMulti<K extends any[], VALUE>(base: KVComponent<K, VALUE[]>): MultiContainer<K, VALUE>;
|
|
1224
1425
|
|
|
1426
|
+
declare class LinkedList<V> extends BaseContainer implements Iterable<V> {
|
|
1427
|
+
private _head;
|
|
1428
|
+
private _tail;
|
|
1429
|
+
private _size;
|
|
1430
|
+
private readonly equals;
|
|
1431
|
+
constructor();
|
|
1432
|
+
constructor(equals?: EqualityFn<V>);
|
|
1433
|
+
constructor(list: LinkedList<V> | Iterable<V>, equals?: EqualityFn<V>);
|
|
1434
|
+
static createDeep<V>(): LinkedList<V>;
|
|
1435
|
+
static createDeep<V>(list: LinkedList<V>): LinkedList<V>;
|
|
1436
|
+
static createDeep<V>(entries: Iterable<V>): LinkedList<V>;
|
|
1437
|
+
get length(): number;
|
|
1438
|
+
get first(): V | undefined;
|
|
1439
|
+
get last(): V | undefined;
|
|
1440
|
+
/** Add item to the end of the list */
|
|
1441
|
+
push(value: V): void;
|
|
1442
|
+
/** Remove item from the end of the list */
|
|
1443
|
+
pop(): V | undefined;
|
|
1444
|
+
/** Add item to the beginning of the list */
|
|
1445
|
+
unshift(value: V): void;
|
|
1446
|
+
/** Remove item from the beginning of the list */
|
|
1447
|
+
shift(): V | undefined;
|
|
1448
|
+
/** Check if value exists in the list */
|
|
1449
|
+
has(value: V): boolean;
|
|
1450
|
+
/** Get value at index (O(n/2)) */
|
|
1451
|
+
get(index: number): V | undefined;
|
|
1452
|
+
/** Set value at index (O(n/2)) */
|
|
1453
|
+
set(index: number, value: V): boolean;
|
|
1454
|
+
/** Insert value at index (O(n/2)) */
|
|
1455
|
+
insertAt(index: number, value: V): boolean;
|
|
1456
|
+
/** Remove value at index (O(n/2)) */
|
|
1457
|
+
removeAt(index: number): V | undefined;
|
|
1458
|
+
/** Remove first matching value (O(n)) */
|
|
1459
|
+
remove(value: V): boolean;
|
|
1460
|
+
/** Convert to array */
|
|
1461
|
+
toArray(): V[];
|
|
1462
|
+
/** Replace contents from array */
|
|
1463
|
+
fromArray(values: Iterable<V>): void;
|
|
1464
|
+
/** Clear all nodes */
|
|
1465
|
+
clear(): void;
|
|
1466
|
+
/** Iterator support */
|
|
1467
|
+
[Symbol.iterator](): Iterator<V>;
|
|
1468
|
+
keys(): IterableIterator<number>;
|
|
1469
|
+
values(): IterableIterator<V>;
|
|
1470
|
+
entries(): IterableIterator<[number, V]>;
|
|
1471
|
+
toString(): string;
|
|
1472
|
+
private nodeAt;
|
|
1473
|
+
clone(): LinkedList<V>;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1225
1476
|
/**
|
|
1226
|
-
*
|
|
1477
|
+
* @deprecated - Use {@link Vec} instead. Will be removed in v2.0.0.
|
|
1478
|
+
* @private
|
|
1227
1479
|
*
|
|
1228
|
-
*
|
|
1480
|
+
* Vec2 class.
|
|
1229
1481
|
*/
|
|
1230
1482
|
declare class Vec2 {
|
|
1231
1483
|
readonly x: number;
|
|
@@ -1239,7 +1491,8 @@ declare class Vec2 {
|
|
|
1239
1491
|
}
|
|
1240
1492
|
|
|
1241
1493
|
/**
|
|
1242
|
-
* @deprecated - Use {@link SignedIndexArray} or {@link IndexArray} instead, they have way more functions.
|
|
1494
|
+
* @deprecated - Use {@link SignedIndexArray} or {@link IndexArray} instead, they have way more functions. Will be removed in v2.0.0.
|
|
1495
|
+
* @private
|
|
1243
1496
|
*
|
|
1244
1497
|
* A cache-like structure optimized for small-range integer keys, including negatives.
|
|
1245
1498
|
*
|
|
@@ -1270,4 +1523,218 @@ declare class SmallIntCache<VALUE> {
|
|
|
1270
1523
|
clear(): void;
|
|
1271
1524
|
}
|
|
1272
1525
|
|
|
1273
|
-
|
|
1526
|
+
/**
|
|
1527
|
+
* @deprecated - Use {@link UniMap} instead. Will be removed in v2.0.0.
|
|
1528
|
+
* @private
|
|
1529
|
+
* A Map implementation mapping a single key to a value.
|
|
1530
|
+
*/
|
|
1531
|
+
declare class Map1<KEY1, VALUE> extends BaseContainer implements KVComponent<[KEY1], VALUE> {
|
|
1532
|
+
private map1;
|
|
1533
|
+
constructor();
|
|
1534
|
+
constructor(map1: Map1<KEY1, VALUE>);
|
|
1535
|
+
constructor(entries: Iterable<[KEY1, VALUE]>);
|
|
1536
|
+
has(key1: KEY1): boolean;
|
|
1537
|
+
set(key1: KEY1, value: VALUE): VALUE;
|
|
1538
|
+
get(key1: KEY1): VALUE | undefined;
|
|
1539
|
+
getOrDefault(key1: KEY1, defaultValue: VALUE): VALUE;
|
|
1540
|
+
getOrCreate(key1: KEY1, value: VALUE): VALUE;
|
|
1541
|
+
getOrCreate(key1: KEY1, creator: () => VALUE): VALUE;
|
|
1542
|
+
delete(key1: KEY1): boolean;
|
|
1543
|
+
clear(): void;
|
|
1544
|
+
get size(): number;
|
|
1545
|
+
isEmpty(): boolean;
|
|
1546
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, map1: Map1<KEY1, VALUE>) => void, thisArg?: any): void;
|
|
1547
|
+
keys(): IterableIterator<KEY1>;
|
|
1548
|
+
values(): IterableIterator<VALUE>;
|
|
1549
|
+
entries(): IterableIterator<[KEY1, VALUE]>;
|
|
1550
|
+
keysArray(): KEY1[];
|
|
1551
|
+
valuesArray(): VALUE[];
|
|
1552
|
+
entriesArray(): [KEY1, VALUE][];
|
|
1553
|
+
kvKeys(): IterableIterator<[KEY1]>;
|
|
1554
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1555
|
+
kvEntries(): IterableIterator<[[KEY1], VALUE]>;
|
|
1556
|
+
[Symbol.iterator](): IterableIterator<[KEY1, VALUE]>;
|
|
1557
|
+
clone(): Map1<KEY1, VALUE>;
|
|
1558
|
+
merge(other: Map1<KEY1, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1) => VALUE): this;
|
|
1559
|
+
some(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
1560
|
+
every(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
1561
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, array: Map1<KEY1, VALUE>) => value is S): Map1<KEY1, S>;
|
|
1562
|
+
filter(predicate: (value: VALUE, key1: KEY1, array: Map1<KEY1, VALUE>) => unknown): Map1<KEY1, VALUE>;
|
|
1563
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1) => VALUE): VALUE;
|
|
1564
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1) => R, init: R): R;
|
|
1565
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1) => R): R[];
|
|
1566
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1) => R): Map1<KEY1, R>;
|
|
1567
|
+
toMap(): Map<KEY1, VALUE>;
|
|
1568
|
+
toString(): string;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
/**
|
|
1572
|
+
* @deprecated - Use {@link BiMap} instead. Will be removed in v2.0.0.
|
|
1573
|
+
* @private
|
|
1574
|
+
* A Map implementation mapping a double key to a value.
|
|
1575
|
+
*/
|
|
1576
|
+
declare class Map2<KEY1, KEY2, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
1577
|
+
private map1;
|
|
1578
|
+
constructor();
|
|
1579
|
+
constructor(map2: Map2<KEY1, KEY2, VALUE>);
|
|
1580
|
+
constructor(entries: Iterable<[KEY1, KEY2, VALUE]>);
|
|
1581
|
+
has(key1: KEY1, key2: KEY2): boolean;
|
|
1582
|
+
set(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
1583
|
+
get(key1: KEY1, key2: KEY2): VALUE | undefined;
|
|
1584
|
+
getOrDefault(key1: KEY1, key2: KEY2, defaultValue: VALUE): VALUE;
|
|
1585
|
+
getOrCreate(key1: KEY1, key2: KEY2, value: VALUE): VALUE;
|
|
1586
|
+
getOrCreate(key1: KEY1, key2: KEY2, creator: () => VALUE): VALUE;
|
|
1587
|
+
delete(key1: KEY1): boolean;
|
|
1588
|
+
delete(key1: KEY1, key2: KEY2): boolean;
|
|
1589
|
+
clear(): void;
|
|
1590
|
+
get size(): number;
|
|
1591
|
+
isEmpty(): boolean;
|
|
1592
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: Map2<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
|
|
1593
|
+
keys(): IterableIterator<[KEY1, KEY2]>;
|
|
1594
|
+
values(): IterableIterator<VALUE>;
|
|
1595
|
+
entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
1596
|
+
keysArray(): [KEY1, KEY2][];
|
|
1597
|
+
valuesArray(): VALUE[];
|
|
1598
|
+
entriesArray(): [KEY1, KEY2, VALUE][];
|
|
1599
|
+
kvKeys(): IterableIterator<[KEY1, KEY2]>;
|
|
1600
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1601
|
+
kvEntries(): IterableIterator<[[KEY1, KEY2], VALUE]>;
|
|
1602
|
+
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
1603
|
+
clone(): Map2<KEY1, KEY2, VALUE>;
|
|
1604
|
+
merge(other: Map2<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
1605
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1606
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
1607
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: Map2<KEY1, KEY2, VALUE>) => value is S): Map2<KEY1, KEY2, S>;
|
|
1608
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, array: Map2<KEY1, KEY2, VALUE>) => unknown): Map2<KEY1, KEY2, VALUE>;
|
|
1609
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2) => VALUE): VALUE;
|
|
1610
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2) => R, init: R): R;
|
|
1611
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): R[];
|
|
1612
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2) => R): Map2<KEY1, KEY2, R>;
|
|
1613
|
+
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
1614
|
+
toString(): string;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
/**
|
|
1618
|
+
* @deprecated - Use {@link TriMap} instead. Will be removed in v2.0.0.
|
|
1619
|
+
* @private
|
|
1620
|
+
* A Map implementation mapping a triple key to a value.
|
|
1621
|
+
*/
|
|
1622
|
+
declare class Map3<KEY1, KEY2, KEY3, VALUE> extends BaseContainer implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
1623
|
+
private map1;
|
|
1624
|
+
constructor();
|
|
1625
|
+
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
1626
|
+
constructor(map3: Map3<KEY1, KEY2, KEY3, VALUE>);
|
|
1627
|
+
has(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
1628
|
+
set(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
1629
|
+
get(key1: KEY1, key2: KEY2, key3: KEY3): VALUE | undefined;
|
|
1630
|
+
getOrDefault(key1: KEY1, key2: KEY2, key3: KEY3, defaultValue: VALUE): VALUE;
|
|
1631
|
+
getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, value: VALUE): VALUE;
|
|
1632
|
+
getOrCreate(key1: KEY1, key2: KEY2, key3: KEY3, creator: () => VALUE): VALUE;
|
|
1633
|
+
delete(key1: KEY1): boolean;
|
|
1634
|
+
delete(key1: KEY1, key2: KEY2): boolean;
|
|
1635
|
+
delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
1636
|
+
clear(): void;
|
|
1637
|
+
get size(): number;
|
|
1638
|
+
isEmpty(): boolean;
|
|
1639
|
+
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: Map3<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
|
|
1640
|
+
keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
1641
|
+
values(): IterableIterator<VALUE>;
|
|
1642
|
+
entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
1643
|
+
keysArray(): [KEY1, KEY2, KEY3][];
|
|
1644
|
+
valuesArray(): VALUE[];
|
|
1645
|
+
entriesArray(): [KEY1, KEY2, KEY3, VALUE][];
|
|
1646
|
+
kvKeys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
1647
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1648
|
+
kvEntries(): IterableIterator<[[KEY1, KEY2, KEY3], VALUE]>;
|
|
1649
|
+
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
1650
|
+
clone(): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
1651
|
+
merge(other: Map3<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
1652
|
+
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1653
|
+
every(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
1654
|
+
filter<S extends VALUE>(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: Map3<KEY1, KEY2, KEY3, VALUE>) => value is S): Map3<KEY1, KEY2, KEY3, S>;
|
|
1655
|
+
filter(predicate: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, array: Map3<KEY1, KEY2, KEY3, VALUE>) => unknown): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
1656
|
+
reduce(fn: (acc: VALUE, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): VALUE;
|
|
1657
|
+
reduce<R>(fn: (acc: R, value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R, init: R): R;
|
|
1658
|
+
mapEntries<R>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): R[];
|
|
1659
|
+
mapValues<R = VALUE>(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => R): Map3<KEY1, KEY2, KEY3, R>;
|
|
1660
|
+
toMap(): Map<[KEY1, KEY2, KEY3], VALUE>;
|
|
1661
|
+
toString(): string;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* @deprecated - Use {@link ValueSet} instead. Will be removed in v2.0.0.
|
|
1666
|
+
* @private
|
|
1667
|
+
* An abstract base class implementation of a Set data structure.
|
|
1668
|
+
*/
|
|
1669
|
+
declare abstract class SetBase<VALUE, CLS extends SetBase<VALUE, CLS> = any> extends BaseContainer implements KVComponent<[VALUE], VALUE> {
|
|
1670
|
+
protected data: Set<VALUE>;
|
|
1671
|
+
constructor(entries?: Iterable<VALUE>);
|
|
1672
|
+
protected abstract valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1673
|
+
protected abstract createEmpty<R = VALUE>(): SetBase<R, any>;
|
|
1674
|
+
has(value: VALUE): boolean;
|
|
1675
|
+
add(value: VALUE): VALUE;
|
|
1676
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1677
|
+
set(key: VALUE, value: VALUE): void;
|
|
1678
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1679
|
+
get(key: VALUE): VALUE | undefined;
|
|
1680
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1681
|
+
getOrDefault(key: VALUE, defaultValue: VALUE): VALUE;
|
|
1682
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1683
|
+
getOrCreate(key: VALUE, value: VALUE): VALUE;
|
|
1684
|
+
/** @internal - This method exists only for interface `KVComponent` compatibility.*/
|
|
1685
|
+
getOrCreate(key: VALUE, creator: () => VALUE): VALUE;
|
|
1686
|
+
delete(value: VALUE): boolean;
|
|
1687
|
+
clear(): void;
|
|
1688
|
+
get size(): number;
|
|
1689
|
+
isEmpty(): boolean;
|
|
1690
|
+
forEach(callbackfn: (value: VALUE, set1: SetBase<VALUE>) => void, thisArg?: any): void;
|
|
1691
|
+
keys(): IterableIterator<VALUE>;
|
|
1692
|
+
values(): IterableIterator<VALUE>;
|
|
1693
|
+
entries(): IterableIterator<[VALUE, VALUE]>;
|
|
1694
|
+
kvKeys(): IterableIterator<[VALUE]>;
|
|
1695
|
+
kvValues(): IterableIterator<VALUE>;
|
|
1696
|
+
kvEntries(): IterableIterator<[[VALUE], VALUE]>;
|
|
1697
|
+
[Symbol.iterator](): IterableIterator<VALUE>;
|
|
1698
|
+
clone(): SetBase<VALUE>;
|
|
1699
|
+
merge(other: SetBase<VALUE>): this;
|
|
1700
|
+
some(fn: (value: VALUE) => boolean): boolean;
|
|
1701
|
+
every(fn: (value: VALUE) => boolean): boolean;
|
|
1702
|
+
filter<R extends VALUE>(predicate: (value: VALUE, set1: SetBase<VALUE, any>) => value is R): SetBase<R, any>;
|
|
1703
|
+
filter(predicate: (value: VALUE, set1: SetBase<VALUE>) => unknown): SetBase<VALUE, any>;
|
|
1704
|
+
reduce(fn: (acc: VALUE, value: VALUE) => VALUE): VALUE;
|
|
1705
|
+
reduce<R = VALUE>(fn: (acc: R, value: VALUE) => R, init: R): R;
|
|
1706
|
+
mapValues<R = VALUE>(fn: (value: VALUE) => R): SetBase<R, any>;
|
|
1707
|
+
mapToArray<R = VALUE>(fn: (value: VALUE) => R): R[];
|
|
1708
|
+
map<R = VALUE>(fn: (value: VALUE) => R): SetBase<R, any>;
|
|
1709
|
+
toSet(): Set<VALUE>;
|
|
1710
|
+
toArray(): VALUE[];
|
|
1711
|
+
toString(): string;
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* @deprecated - Use {@link ValueSet} instead. Will be removed in v2.0.0.
|
|
1715
|
+
* @private
|
|
1716
|
+
* A simple Set data structure. Comparison of values is done
|
|
1717
|
+
* using === operator (e.g. "a" === "a", but [1, 2] !== [1, 2]).
|
|
1718
|
+
*/
|
|
1719
|
+
declare class Set1<VALUE> extends SetBase<VALUE, Set1<VALUE>> {
|
|
1720
|
+
constructor();
|
|
1721
|
+
constructor(set: SetBase<VALUE>);
|
|
1722
|
+
constructor(entries: Iterable<VALUE>);
|
|
1723
|
+
protected createEmpty<R = VALUE>(): Set1<R>;
|
|
1724
|
+
protected valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1725
|
+
}
|
|
1726
|
+
/**
|
|
1727
|
+
* @deprecated - Use {@link ValueSet}.createDeep() instead. Will be removed in v2.0.0.
|
|
1728
|
+
* @private
|
|
1729
|
+
* A simple Set data structure, where comparison of values is done
|
|
1730
|
+
* using deep equality (e.g. "a" === "a" and also [1, 2] === [1, 2]).
|
|
1731
|
+
*/
|
|
1732
|
+
declare class DeepSet<VALUE> extends SetBase<VALUE, DeepSet<VALUE>> {
|
|
1733
|
+
constructor();
|
|
1734
|
+
constructor(set: SetBase<VALUE>);
|
|
1735
|
+
constructor(entries: Iterable<VALUE>);
|
|
1736
|
+
protected createEmpty<R = VALUE>(): DeepSet<R>;
|
|
1737
|
+
protected valueEquals(a: VALUE, b: VALUE): boolean;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
export { index$7 as Assert, BaseContainer, BiMap, cookies as Cookies, DeepSet, DefaultArray, DefaultEqualityFn, device as Device, DivRect, type EqualityFn, Guard, IndexArray, type KVComponent, LRUCache, LinkedList, Map1, Map2, Map3, MultiContainer, Set1, SetBase, SignedIndexArray, SmallIntCache, Stack, TriMap, UniMap, index as Utils, ValueSet, Vec, Vec2, asMulti };
|