@tspro/ts-utils-lib 1.14.0 → 1.15.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 +10 -0
- package/README.md +10 -4
- package/dist/index.d.mts +215 -130
- package/dist/index.d.ts +215 -130
- package/dist/index.js +577 -318
- package/dist/index.mjs +573 -317
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.15.0] - 2025-10-20
|
|
4
|
+
### Added
|
|
5
|
+
- SignedIndexArray.equals()
|
|
6
|
+
- class IndexArray<EL>, same as SignedIndexArray but for non-negative indices.
|
|
7
|
+
- Added KVComponent interface for Map1, Map2, Map3, IndexArray and SignedIndexArray.
|
|
8
|
+
- Added MultiContainer.
|
|
9
|
+
|
|
10
|
+
## Deprecate
|
|
11
|
+
- SmallIntCache, use SignedIndexArray has same functionality and more.
|
|
12
|
+
|
|
3
13
|
## [1.14.0] - 2025-10-19
|
|
4
14
|
### Added
|
|
5
15
|
- Map1, Map2 and Map3.getOrCreate() accepts value and creator.
|
package/README.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tspro/ts-utils-lib
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## About
|
|
4
|
+
A small collection of TypeScript functions, containers, etc. used in my personal projects.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
## Links
|
|
7
|
+
[GitHub repo](https://github.com/pahkasoft/ts-utils-lib) |
|
|
8
|
+
[NPM pkg](https://www.npmjs.com/package/@tspro/ts-utils-lib) |
|
|
9
|
+
[Homepage](https://pahkasoft.github.io/)
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
`npm i @tspro/ts-utils-lib`
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,84 @@
|
|
|
1
|
-
declare function
|
|
1
|
+
declare function isUndefined(value: unknown): value is undefined;
|
|
2
|
+
declare function isNull(value: unknown): value is null;
|
|
3
|
+
declare function isNullish(value: unknown): value is null | undefined;
|
|
4
|
+
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
5
|
+
declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
|
|
6
|
+
declare function isArray<T>(a: T[] | unknown): a is T[];
|
|
7
|
+
declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
|
|
8
|
+
declare function isEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
9
|
+
declare function isNonEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
10
|
+
declare function isEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
11
|
+
declare function isNonEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
12
|
+
declare function isString(value: unknown): value is string;
|
|
13
|
+
declare function isEmptyString(value: unknown): value is "";
|
|
14
|
+
declare function isNonEmptyString(value: unknown): value is string;
|
|
15
|
+
declare function isStringOrUndefined(value: unknown): value is string | undefined;
|
|
16
|
+
declare function isEmptyStringOrUndefined(value: unknown): value is "" | undefined;
|
|
17
|
+
declare function isNonEmptyStringOrUndefined(value: unknown): value is string | undefined;
|
|
18
|
+
declare function isBoolean(value: unknown): value is boolean;
|
|
19
|
+
declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
|
|
20
|
+
declare function isFunction(value: unknown): value is Function;
|
|
21
|
+
declare function isFunctionOrUndefined(value: unknown): value is Function | undefined;
|
|
22
|
+
declare function isEnumValue<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E];
|
|
23
|
+
declare function isEnumValueOrUndefined<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E] | undefined;
|
|
24
|
+
declare function isNumber(value: unknown): value is number;
|
|
25
|
+
declare function isNumberOrUndefined(value: unknown): value is number | undefined;
|
|
26
|
+
declare function isFinite(value: unknown): value is number;
|
|
27
|
+
declare function isInteger(n: unknown): n is number;
|
|
28
|
+
declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
|
|
29
|
+
declare function isIntegerEq(value: unknown, compareTo: number): value is number;
|
|
30
|
+
declare function isIntegerGt(value: unknown, compareTo: number): value is number;
|
|
31
|
+
declare function isIntegerGte(value: unknown, compareTo: number): value is number;
|
|
32
|
+
declare function isIntegerLt(value: unknown, compareTo: number): value is number;
|
|
33
|
+
declare function isIntegerLte(value: unknown, compareTo: number): value is number;
|
|
34
|
+
declare function isIntegerBetween(value: unknown, min: number, max: number): value is number;
|
|
35
|
+
declare function isNaNValue(value: unknown): value is number;
|
|
36
|
+
declare function isInfinity(value: unknown): value is number;
|
|
37
|
+
declare function isPosInfinity(value: unknown): value is number;
|
|
38
|
+
declare function isNegInfinity(value: unknown): value is number;
|
|
39
|
+
|
|
40
|
+
declare const index$8_isArray: typeof isArray;
|
|
41
|
+
declare const index$8_isArrayOrUndefined: typeof isArrayOrUndefined;
|
|
42
|
+
declare const index$8_isBoolean: typeof isBoolean;
|
|
43
|
+
declare const index$8_isBooleanOrUndefined: typeof isBooleanOrUndefined;
|
|
44
|
+
declare const index$8_isEmptyArray: typeof isEmptyArray;
|
|
45
|
+
declare const index$8_isEmptyArrayOrUndefined: typeof isEmptyArrayOrUndefined;
|
|
46
|
+
declare const index$8_isEmptyString: typeof isEmptyString;
|
|
47
|
+
declare const index$8_isEmptyStringOrUndefined: typeof isEmptyStringOrUndefined;
|
|
48
|
+
declare const index$8_isEnumValue: typeof isEnumValue;
|
|
49
|
+
declare const index$8_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
|
|
50
|
+
declare const index$8_isFinite: typeof isFinite;
|
|
51
|
+
declare const index$8_isFunction: typeof isFunction;
|
|
52
|
+
declare const index$8_isFunctionOrUndefined: typeof isFunctionOrUndefined;
|
|
53
|
+
declare const index$8_isInfinity: typeof isInfinity;
|
|
54
|
+
declare const index$8_isInteger: typeof isInteger;
|
|
55
|
+
declare const index$8_isIntegerBetween: typeof isIntegerBetween;
|
|
56
|
+
declare const index$8_isIntegerEq: typeof isIntegerEq;
|
|
57
|
+
declare const index$8_isIntegerGt: typeof isIntegerGt;
|
|
58
|
+
declare const index$8_isIntegerGte: typeof isIntegerGte;
|
|
59
|
+
declare const index$8_isIntegerLt: typeof isIntegerLt;
|
|
60
|
+
declare const index$8_isIntegerLte: typeof isIntegerLte;
|
|
61
|
+
declare const index$8_isIntegerOrUndefined: typeof isIntegerOrUndefined;
|
|
62
|
+
declare const index$8_isNaNValue: typeof isNaNValue;
|
|
63
|
+
declare const index$8_isNegInfinity: typeof isNegInfinity;
|
|
64
|
+
declare const index$8_isNonEmptyArray: typeof isNonEmptyArray;
|
|
65
|
+
declare const index$8_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
66
|
+
declare const index$8_isNonEmptyString: typeof isNonEmptyString;
|
|
67
|
+
declare const index$8_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
68
|
+
declare const index$8_isNull: typeof isNull;
|
|
69
|
+
declare const index$8_isNullish: typeof isNullish;
|
|
70
|
+
declare const index$8_isNumber: typeof isNumber;
|
|
71
|
+
declare const index$8_isNumberOrUndefined: typeof isNumberOrUndefined;
|
|
72
|
+
declare const index$8_isObject: typeof isObject;
|
|
73
|
+
declare const index$8_isObjectOrUndefined: typeof isObjectOrUndefined;
|
|
74
|
+
declare const index$8_isPosInfinity: typeof isPosInfinity;
|
|
75
|
+
declare const index$8_isString: typeof isString;
|
|
76
|
+
declare const index$8_isStringOrUndefined: typeof isStringOrUndefined;
|
|
77
|
+
declare const index$8_isUndefined: typeof isUndefined;
|
|
78
|
+
declare namespace index$8 {
|
|
79
|
+
export { index$8_isArray as isArray, index$8_isArrayOrUndefined as isArrayOrUndefined, index$8_isBoolean as isBoolean, index$8_isBooleanOrUndefined as isBooleanOrUndefined, index$8_isEmptyArray as isEmptyArray, index$8_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, index$8_isEmptyString as isEmptyString, index$8_isEmptyStringOrUndefined as isEmptyStringOrUndefined, index$8_isEnumValue as isEnumValue, index$8_isEnumValueOrUndefined as isEnumValueOrUndefined, index$8_isFinite as isFinite, index$8_isFunction as isFunction, index$8_isFunctionOrUndefined as isFunctionOrUndefined, index$8_isInfinity as isInfinity, index$8_isInteger as isInteger, index$8_isIntegerBetween as isIntegerBetween, index$8_isIntegerEq as isIntegerEq, index$8_isIntegerGt as isIntegerGt, index$8_isIntegerGte as isIntegerGte, index$8_isIntegerLt as isIntegerLt, index$8_isIntegerLte as isIntegerLte, index$8_isIntegerOrUndefined as isIntegerOrUndefined, index$8_isNaNValue as isNaNValue, index$8_isNegInfinity as isNegInfinity, index$8_isNonEmptyArray as isNonEmptyArray, index$8_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, index$8_isNonEmptyString as isNonEmptyString, index$8_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, index$8_isNull as isNull, index$8_isNullish as isNullish, index$8_isNumber as isNumber, index$8_isNumberOrUndefined as isNumberOrUndefined, index$8_isObject as isObject, index$8_isObjectOrUndefined as isObjectOrUndefined, index$8_isPosInfinity as isPosInfinity, index$8_isString as isString, index$8_isStringOrUndefined as isStringOrUndefined, index$8_isUndefined as isUndefined };
|
|
80
|
+
}
|
|
81
|
+
|
|
2
82
|
declare function toArray<T>(a: T | T[]): Array<T>;
|
|
3
83
|
declare function duplicate<T>(a: T[] | undefined): T[] | undefined;
|
|
4
84
|
declare function removeDuplicates<T>(a: T[]): T[];
|
|
@@ -11,19 +91,20 @@ declare function getRangeArray(start: number, end: number): number[];
|
|
|
11
91
|
declare function arrayContains<T extends unknown>(arg: T[], item: T): boolean;
|
|
12
92
|
declare function chunckArray<A>(arr: ReadonlyArray<A>, chunckSize: number): A[][];
|
|
13
93
|
|
|
14
|
-
declare const index$
|
|
15
|
-
declare const index$
|
|
16
|
-
declare const index$
|
|
17
|
-
declare const index$
|
|
18
|
-
declare const index$
|
|
19
|
-
declare const index$
|
|
20
|
-
declare const index$
|
|
21
|
-
declare const index$
|
|
22
|
-
declare const index$
|
|
23
|
-
declare const index$
|
|
24
|
-
declare const index$
|
|
25
|
-
declare
|
|
26
|
-
|
|
94
|
+
declare const index$7_arrayContains: typeof arrayContains;
|
|
95
|
+
declare const index$7_chunckArray: typeof chunckArray;
|
|
96
|
+
declare const index$7_duplicate: typeof duplicate;
|
|
97
|
+
declare const index$7_fillArray: typeof fillArray;
|
|
98
|
+
declare const index$7_getRangeArray: typeof getRangeArray;
|
|
99
|
+
declare const index$7_getSequenceArray: typeof getSequenceArray;
|
|
100
|
+
declare const index$7_isArray: typeof isArray;
|
|
101
|
+
declare const index$7_mapRangeArray: typeof mapRangeArray;
|
|
102
|
+
declare const index$7_mapSequenceArray: typeof mapSequenceArray;
|
|
103
|
+
declare const index$7_removeDuplicates: typeof removeDuplicates;
|
|
104
|
+
declare const index$7_removeDuplicatesCmp: typeof removeDuplicatesCmp;
|
|
105
|
+
declare const index$7_toArray: typeof toArray;
|
|
106
|
+
declare namespace index$7 {
|
|
107
|
+
export { index$7_arrayContains as arrayContains, index$7_chunckArray as chunckArray, index$7_duplicate as duplicate, index$7_fillArray as fillArray, index$7_getRangeArray as getRangeArray, index$7_getSequenceArray as getSequenceArray, index$7_isArray as isArray, index$7_mapRangeArray as mapRangeArray, index$7_mapSequenceArray as mapSequenceArray, index$7_removeDuplicates as removeDuplicates, index$7_removeDuplicatesCmp as removeDuplicatesCmp, index$7_toArray as toArray };
|
|
27
108
|
}
|
|
28
109
|
|
|
29
110
|
interface CSSProperties {
|
|
@@ -72,28 +153,28 @@ declare function getDimension(style?: CSSProperties): {
|
|
|
72
153
|
declare function styleLayoutChanged(style1?: CSSProperties, style2?: CSSProperties): boolean;
|
|
73
154
|
declare function getCanvasTextWidth(text: string, font: string): number;
|
|
74
155
|
|
|
75
|
-
type index$
|
|
76
|
-
declare const index$
|
|
77
|
-
declare const index$
|
|
78
|
-
declare const index$
|
|
79
|
-
declare const index$
|
|
80
|
-
declare const index$
|
|
81
|
-
declare const index$
|
|
82
|
-
declare const index$
|
|
83
|
-
declare const index$
|
|
84
|
-
declare const index$
|
|
85
|
-
declare const index$
|
|
86
|
-
declare const index$
|
|
87
|
-
declare const index$
|
|
88
|
-
declare const index$
|
|
89
|
-
declare const index$
|
|
90
|
-
declare const index$
|
|
91
|
-
declare const index$
|
|
92
|
-
declare const index$
|
|
93
|
-
declare const index$
|
|
94
|
-
declare const index$
|
|
95
|
-
declare namespace index$
|
|
96
|
-
export { type index$
|
|
156
|
+
type index$6_CSSProperties = CSSProperties;
|
|
157
|
+
declare const index$6_addClass: typeof addClass;
|
|
158
|
+
declare const index$6_appendTo: typeof appendTo;
|
|
159
|
+
declare const index$6_getButton: typeof getButton;
|
|
160
|
+
declare const index$6_getCanvas: typeof getCanvas;
|
|
161
|
+
declare const index$6_getCanvasTextWidth: typeof getCanvasTextWidth;
|
|
162
|
+
declare const index$6_getDimension: typeof getDimension;
|
|
163
|
+
declare const index$6_getHeight: typeof getHeight;
|
|
164
|
+
declare const index$6_getOffset: typeof getOffset;
|
|
165
|
+
declare const index$6_getPadding: typeof getPadding;
|
|
166
|
+
declare const index$6_getWidth: typeof getWidth;
|
|
167
|
+
declare const index$6_hasClass: typeof hasClass;
|
|
168
|
+
declare const index$6_removeClass: typeof removeClass;
|
|
169
|
+
declare const index$6_removeFromParent: typeof removeFromParent;
|
|
170
|
+
declare const index$6_setHeight: typeof setHeight;
|
|
171
|
+
declare const index$6_setOffset: typeof setOffset;
|
|
172
|
+
declare const index$6_setRect: typeof setRect;
|
|
173
|
+
declare const index$6_setVisibility: typeof setVisibility;
|
|
174
|
+
declare const index$6_setWidth: typeof setWidth;
|
|
175
|
+
declare const index$6_styleLayoutChanged: typeof styleLayoutChanged;
|
|
176
|
+
declare namespace index$6 {
|
|
177
|
+
export { type index$6_CSSProperties as CSSProperties, index$6_addClass as addClass, index$6_appendTo as appendTo, index$6_getButton as getButton, index$6_getCanvas as getCanvas, index$6_getCanvasTextWidth as getCanvasTextWidth, index$6_getDimension as getDimension, index$6_getHeight as getHeight, index$6_getOffset as getOffset, index$6_getPadding as getPadding, index$6_getWidth as getWidth, index$6_hasClass as hasClass, index$6_removeClass as removeClass, index$6_removeFromParent as removeFromParent, index$6_setHeight as setHeight, index$6_setOffset as setOffset, index$6_setRect as setRect, index$6_setVisibility as setVisibility, index$6_setWidth as setWidth, index$6_styleLayoutChanged as styleLayoutChanged };
|
|
97
178
|
}
|
|
98
179
|
|
|
99
180
|
type EnumObject = {
|
|
@@ -104,90 +185,11 @@ type EnumValue<E extends EnumObject> = E extends {
|
|
|
104
185
|
} ? V : never;
|
|
105
186
|
declare function getEnumValues<E extends EnumObject>(e: E): Array<EnumValue<E>>;
|
|
106
187
|
|
|
107
|
-
type index$
|
|
108
|
-
type index$
|
|
109
|
-
declare const index$
|
|
110
|
-
declare namespace index$6 {
|
|
111
|
-
export { type index$6_EnumObject as EnumObject, type index$6_EnumValue as EnumValue, index$6_getEnumValues as getEnumValues };
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
declare function isUndefined(value: unknown): value is undefined;
|
|
115
|
-
declare function isNull(value: unknown): value is null;
|
|
116
|
-
declare function isNullish(value: unknown): value is null | undefined;
|
|
117
|
-
declare function isObject$1(value: unknown): value is Record<string, unknown>;
|
|
118
|
-
declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
|
|
119
|
-
declare function isArray<T>(a: T[] | unknown): a is T[];
|
|
120
|
-
declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
|
|
121
|
-
declare function isEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
122
|
-
declare function isNonEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
123
|
-
declare function isEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
124
|
-
declare function isNonEmptyArrayOrUndefined<T>(a: T[] | unknown): a is T[] | undefined;
|
|
125
|
-
declare function isString(value: unknown): value is string;
|
|
126
|
-
declare function isEmptyString(value: unknown): value is "";
|
|
127
|
-
declare function isNonEmptyString(value: unknown): value is string;
|
|
128
|
-
declare function isStringOrUndefined(value: unknown): value is string | undefined;
|
|
129
|
-
declare function isEmptyStringOrUndefined(value: unknown): value is "" | undefined;
|
|
130
|
-
declare function isNonEmptyStringOrUndefined(value: unknown): value is string | undefined;
|
|
131
|
-
declare function isBoolean(value: unknown): value is boolean;
|
|
132
|
-
declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
|
|
133
|
-
declare function isFunction(value: unknown): value is Function;
|
|
134
|
-
declare function isFunctionOrUndefined(value: unknown): value is Function | undefined;
|
|
135
|
-
declare function isEnumValue<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E];
|
|
136
|
-
declare function isEnumValueOrUndefined<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E] | undefined;
|
|
137
|
-
declare function isNumber(value: unknown): value is number;
|
|
138
|
-
declare function isNumberOrUndefined(value: unknown): value is number | undefined;
|
|
139
|
-
declare function isFinite(value: unknown): value is number;
|
|
140
|
-
declare function isInteger$1(n: unknown): n is number;
|
|
141
|
-
declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
|
|
142
|
-
declare function isIntegerEq(value: unknown, compareTo: number): value is number;
|
|
143
|
-
declare function isIntegerGt(value: unknown, compareTo: number): value is number;
|
|
144
|
-
declare function isIntegerGte(value: unknown, compareTo: number): value is number;
|
|
145
|
-
declare function isIntegerLt(value: unknown, compareTo: number): value is number;
|
|
146
|
-
declare function isIntegerLte(value: unknown, compareTo: number): value is number;
|
|
147
|
-
declare function isIntegerBetween(value: unknown, min: number, max: number): value is number;
|
|
148
|
-
declare function isNaNValue(value: unknown): value is number;
|
|
149
|
-
declare function isInfinity(value: unknown): value is number;
|
|
150
|
-
declare function isPosInfinity(value: unknown): value is number;
|
|
151
|
-
declare function isNegInfinity(value: unknown): value is number;
|
|
152
|
-
|
|
153
|
-
declare const index$5_isArray: typeof isArray;
|
|
154
|
-
declare const index$5_isArrayOrUndefined: typeof isArrayOrUndefined;
|
|
155
|
-
declare const index$5_isBoolean: typeof isBoolean;
|
|
156
|
-
declare const index$5_isBooleanOrUndefined: typeof isBooleanOrUndefined;
|
|
157
|
-
declare const index$5_isEmptyArray: typeof isEmptyArray;
|
|
158
|
-
declare const index$5_isEmptyArrayOrUndefined: typeof isEmptyArrayOrUndefined;
|
|
159
|
-
declare const index$5_isEmptyString: typeof isEmptyString;
|
|
160
|
-
declare const index$5_isEmptyStringOrUndefined: typeof isEmptyStringOrUndefined;
|
|
161
|
-
declare const index$5_isEnumValue: typeof isEnumValue;
|
|
162
|
-
declare const index$5_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
|
|
163
|
-
declare const index$5_isFinite: typeof isFinite;
|
|
164
|
-
declare const index$5_isFunction: typeof isFunction;
|
|
165
|
-
declare const index$5_isFunctionOrUndefined: typeof isFunctionOrUndefined;
|
|
166
|
-
declare const index$5_isInfinity: typeof isInfinity;
|
|
167
|
-
declare const index$5_isIntegerBetween: typeof isIntegerBetween;
|
|
168
|
-
declare const index$5_isIntegerEq: typeof isIntegerEq;
|
|
169
|
-
declare const index$5_isIntegerGt: typeof isIntegerGt;
|
|
170
|
-
declare const index$5_isIntegerGte: typeof isIntegerGte;
|
|
171
|
-
declare const index$5_isIntegerLt: typeof isIntegerLt;
|
|
172
|
-
declare const index$5_isIntegerLte: typeof isIntegerLte;
|
|
173
|
-
declare const index$5_isIntegerOrUndefined: typeof isIntegerOrUndefined;
|
|
174
|
-
declare const index$5_isNaNValue: typeof isNaNValue;
|
|
175
|
-
declare const index$5_isNegInfinity: typeof isNegInfinity;
|
|
176
|
-
declare const index$5_isNonEmptyArray: typeof isNonEmptyArray;
|
|
177
|
-
declare const index$5_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
178
|
-
declare const index$5_isNonEmptyString: typeof isNonEmptyString;
|
|
179
|
-
declare const index$5_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
180
|
-
declare const index$5_isNull: typeof isNull;
|
|
181
|
-
declare const index$5_isNullish: typeof isNullish;
|
|
182
|
-
declare const index$5_isNumber: typeof isNumber;
|
|
183
|
-
declare const index$5_isNumberOrUndefined: typeof isNumberOrUndefined;
|
|
184
|
-
declare const index$5_isObjectOrUndefined: typeof isObjectOrUndefined;
|
|
185
|
-
declare const index$5_isPosInfinity: typeof isPosInfinity;
|
|
186
|
-
declare const index$5_isString: typeof isString;
|
|
187
|
-
declare const index$5_isStringOrUndefined: typeof isStringOrUndefined;
|
|
188
|
-
declare const index$5_isUndefined: typeof isUndefined;
|
|
188
|
+
type index$5_EnumObject = EnumObject;
|
|
189
|
+
type index$5_EnumValue<E extends EnumObject> = EnumValue<E>;
|
|
190
|
+
declare const index$5_getEnumValues: typeof getEnumValues;
|
|
189
191
|
declare namespace index$5 {
|
|
190
|
-
export {
|
|
192
|
+
export { type index$5_EnumObject as EnumObject, type index$5_EnumValue as EnumValue, index$5_getEnumValues as getEnumValues };
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
declare function getMapKeys<K, V>(map: Map<K, V>): K[];
|
|
@@ -197,7 +199,6 @@ declare namespace index$4 {
|
|
|
197
199
|
export { index$4_getMapKeys as getMapKeys };
|
|
198
200
|
}
|
|
199
201
|
|
|
200
|
-
declare function isInteger(n: unknown): n is number;
|
|
201
202
|
declare function linearToDecibels(linearVolume: number): number;
|
|
202
203
|
declare function mod(m: number, n: number): number;
|
|
203
204
|
/**
|
|
@@ -227,16 +228,16 @@ declare const index$3_cmp: typeof cmp;
|
|
|
227
228
|
declare const index$3_interpolateCoord: typeof interpolateCoord;
|
|
228
229
|
declare const index$3_interpolateY: typeof interpolateY;
|
|
229
230
|
declare const index$3_isInteger: typeof isInteger;
|
|
231
|
+
declare const index$3_isNumber: typeof isNumber;
|
|
230
232
|
declare const index$3_linearToDecibels: typeof linearToDecibels;
|
|
231
233
|
declare const index$3_mod: typeof mod;
|
|
232
234
|
declare const index$3_romanize: typeof romanize;
|
|
233
235
|
declare const index$3_sum: typeof sum;
|
|
234
236
|
declare const index$3_toOrdinalNumber: typeof toOrdinalNumber;
|
|
235
237
|
declare namespace index$3 {
|
|
236
|
-
export { index$3_avg as avg, index$3_calcNormal as calcNormal, index$3_clamp as clamp, index$3_cmp as cmp, index$3_interpolateCoord as interpolateCoord, index$3_interpolateY as interpolateY, index$3_isInteger as isInteger, index$3_linearToDecibels as linearToDecibels, index$3_mod as mod, index$3_romanize as romanize, index$3_sum as sum, index$3_toOrdinalNumber as toOrdinalNumber };
|
|
238
|
+
export { index$3_avg as avg, index$3_calcNormal as calcNormal, index$3_clamp as clamp, index$3_cmp as cmp, index$3_interpolateCoord as interpolateCoord, index$3_interpolateY as interpolateY, index$3_isInteger as isInteger, index$3_isNumber as isNumber, index$3_linearToDecibels as linearToDecibels, index$3_mod as mod, index$3_romanize as romanize, index$3_sum as sum, index$3_toOrdinalNumber as toOrdinalNumber };
|
|
237
239
|
}
|
|
238
240
|
|
|
239
|
-
declare function isObject(obj: unknown): obj is Record<string, unknown>;
|
|
240
241
|
/**
|
|
241
242
|
* <pre>
|
|
242
243
|
* Usage:
|
|
@@ -310,17 +311,18 @@ declare function makeSentenceFromPascal(PascalString: string): string;
|
|
|
310
311
|
declare const index$1_charCount: typeof charCount;
|
|
311
312
|
declare const index$1_chunkString: typeof chunkString;
|
|
312
313
|
declare const index$1_insertAt: typeof insertAt;
|
|
314
|
+
declare const index$1_isString: typeof isString;
|
|
313
315
|
declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
|
|
314
316
|
declare const index$1_removeAt: typeof removeAt;
|
|
315
317
|
declare const index$1_repeatString: typeof repeatString;
|
|
316
318
|
declare const index$1_replaceAt: typeof replaceAt;
|
|
317
319
|
declare const index$1_toCharArray: typeof toCharArray;
|
|
318
320
|
declare namespace index$1 {
|
|
319
|
-
export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, 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 };
|
|
321
|
+
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 };
|
|
320
322
|
}
|
|
321
323
|
|
|
322
324
|
declare namespace index {
|
|
323
|
-
export { index$
|
|
325
|
+
export { index$7 as Arr, index$6 as Dom, index$5 as Enum, index$8 as Is, index$4 as Map, index$3 as Math, index$2 as Obj, index$1 as Str };
|
|
324
326
|
}
|
|
325
327
|
|
|
326
328
|
declare namespace Assert {
|
|
@@ -434,6 +436,8 @@ declare class LRUCache<K extends string, V> {
|
|
|
434
436
|
* cache.set(3, 'B');
|
|
435
437
|
* console.log(cache.get(-2)); // 'A'
|
|
436
438
|
* ```
|
|
439
|
+
*
|
|
440
|
+
* @deprecated - Same functionality an more is available now in SignedIndexArray<EL> and IndexArray<EL> containers.
|
|
437
441
|
*/
|
|
438
442
|
declare class SmallIntCache<V> {
|
|
439
443
|
private pos;
|
|
@@ -446,20 +450,79 @@ declare class SmallIntCache<V> {
|
|
|
446
450
|
clear(): void;
|
|
447
451
|
}
|
|
448
452
|
|
|
453
|
+
interface KVComponent<K extends any[], EL> {
|
|
454
|
+
get size(): number;
|
|
455
|
+
has(...keys: K): boolean;
|
|
456
|
+
get(...keys: K): EL | undefined;
|
|
457
|
+
getOrDefault(...keysAndDefault: [...K, EL]): EL;
|
|
458
|
+
getOrCreate(...keysAndCreator: [...K, EL]): EL;
|
|
459
|
+
set(...keysAndValue: [...K, EL]): void;
|
|
460
|
+
delete(...keys: K): boolean;
|
|
461
|
+
clear?(): void;
|
|
462
|
+
toString(): string;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* An array-like structure for non-negative indexes.
|
|
467
|
+
*/
|
|
468
|
+
declare class IndexArray<EL> implements KVComponent<[number], EL> {
|
|
469
|
+
private static toNegIndex;
|
|
470
|
+
private static validateIndex;
|
|
471
|
+
private posEl;
|
|
472
|
+
private hasPos;
|
|
473
|
+
private elCount;
|
|
474
|
+
constructor();
|
|
475
|
+
constructor(arr: IndexArray<EL>);
|
|
476
|
+
constructor(entries: Iterable<[number, EL]>);
|
|
477
|
+
get size(): number;
|
|
478
|
+
private get posLen();
|
|
479
|
+
has(id: number): boolean;
|
|
480
|
+
set(id: number, el: EL): void;
|
|
481
|
+
get(id: number): EL | undefined;
|
|
482
|
+
getOrDefault(id: number, defaultValue: EL): EL;
|
|
483
|
+
getOrCreate(id: number, value: EL): EL;
|
|
484
|
+
getOrCreate(id: number, creator: () => EL): EL;
|
|
485
|
+
delete(id: number): boolean;
|
|
486
|
+
clear(): void;
|
|
487
|
+
forEach(callbackfn: (el: EL, id: number, arr: IndexArray<EL>) => void, thisArg?: any): void;
|
|
488
|
+
indices(): IterableIterator<number>;
|
|
489
|
+
indicesArray(): number[];
|
|
490
|
+
values(): IterableIterator<EL>;
|
|
491
|
+
valuesArray(): EL[];
|
|
492
|
+
entries(): IterableIterator<[number, EL]>;
|
|
493
|
+
entriesArray(): [number, EL][];
|
|
494
|
+
[Symbol.iterator](): Generator<[number, EL], void, any>;
|
|
495
|
+
clone(): IndexArray<EL>;
|
|
496
|
+
merge(other: IndexArray<EL>, conflictResolver?: (oldValue: EL, newValue: EL, id: number) => EL): this;
|
|
497
|
+
some(fn: (el: EL, id: number) => boolean): boolean;
|
|
498
|
+
every(fn: (value: EL, key1: number) => boolean): boolean;
|
|
499
|
+
filter(fn: (value: EL, key1: number) => boolean): IndexArray<EL>;
|
|
500
|
+
reduce(fn: (acc: EL, el: EL, id: number) => EL): EL;
|
|
501
|
+
reduce<R>(fn: (acc: R, el: EL, id: number) => R, init: R): R;
|
|
502
|
+
mapToArray<R>(fn: (value: EL, key1: number) => R): R[];
|
|
503
|
+
map<R = EL>(fn: (value: EL, key1: number) => R): IndexArray<R>;
|
|
504
|
+
equals(other: IndexArray<EL>): boolean;
|
|
505
|
+
equals(other: IndexArray<EL>, eq: (a: EL, b: EL) => boolean): boolean;
|
|
506
|
+
toString(): string;
|
|
507
|
+
}
|
|
508
|
+
|
|
449
509
|
/**
|
|
450
510
|
* An array-like structure for signed indexes, including negatives.
|
|
451
511
|
*/
|
|
452
|
-
declare class SignedIndexArray<EL> {
|
|
512
|
+
declare class SignedIndexArray<EL> implements KVComponent<[number], EL> {
|
|
513
|
+
private static toNegIndex;
|
|
514
|
+
private static validateIndex;
|
|
453
515
|
private posEl;
|
|
454
516
|
private hasPos;
|
|
455
517
|
private negEl;
|
|
456
518
|
private hasNeg;
|
|
457
519
|
private elCount;
|
|
458
|
-
private static toNegIndex;
|
|
459
520
|
constructor();
|
|
460
521
|
constructor(arr: SignedIndexArray<EL>);
|
|
461
522
|
constructor(entries: Iterable<[number, EL]>);
|
|
462
523
|
get size(): number;
|
|
524
|
+
private get posLen();
|
|
525
|
+
private get negLen();
|
|
463
526
|
has(id: number): boolean;
|
|
464
527
|
set(id: number, el: EL): void;
|
|
465
528
|
get(id: number): EL | undefined;
|
|
@@ -485,10 +548,12 @@ declare class SignedIndexArray<EL> {
|
|
|
485
548
|
reduce<R>(fn: (acc: R, el: EL, id: number) => R, init: R): R;
|
|
486
549
|
mapToArray<R>(fn: (value: EL, key1: number) => R): R[];
|
|
487
550
|
map<R = EL>(fn: (value: EL, key1: number) => R): SignedIndexArray<R>;
|
|
551
|
+
equals(other: SignedIndexArray<EL>): boolean;
|
|
552
|
+
equals(other: SignedIndexArray<EL>, eq: (a: EL, b: EL) => boolean): boolean;
|
|
488
553
|
toString(): string;
|
|
489
554
|
}
|
|
490
555
|
|
|
491
|
-
declare class Map1<KEY1, VALUE> {
|
|
556
|
+
declare class Map1<KEY1, VALUE> implements KVComponent<[KEY1], VALUE> {
|
|
492
557
|
private map1;
|
|
493
558
|
constructor();
|
|
494
559
|
constructor(map1: Map1<KEY1, VALUE>);
|
|
@@ -521,7 +586,7 @@ declare class Map1<KEY1, VALUE> {
|
|
|
521
586
|
toMap(): Map<KEY1, VALUE>;
|
|
522
587
|
toString(): string;
|
|
523
588
|
}
|
|
524
|
-
declare class Map2<KEY1, KEY2, VALUE> {
|
|
589
|
+
declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
525
590
|
private map1;
|
|
526
591
|
constructor();
|
|
527
592
|
constructor(map2: Map2<KEY1, KEY2, VALUE>);
|
|
@@ -555,7 +620,7 @@ declare class Map2<KEY1, KEY2, VALUE> {
|
|
|
555
620
|
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
556
621
|
toString(): string;
|
|
557
622
|
}
|
|
558
|
-
declare class Map3<KEY1, KEY2, KEY3, VALUE> {
|
|
623
|
+
declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
559
624
|
private map1;
|
|
560
625
|
constructor();
|
|
561
626
|
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
@@ -591,4 +656,24 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> {
|
|
|
591
656
|
toString(): string;
|
|
592
657
|
}
|
|
593
658
|
|
|
594
|
-
|
|
659
|
+
declare class MultiContainer<K extends any[], V> {
|
|
660
|
+
private readonly base;
|
|
661
|
+
constructor(base: KVComponent<K, V[]>);
|
|
662
|
+
add(...keysAndValue: [...K, V]): V;
|
|
663
|
+
remove(...keysAndValue: [...K, V]): boolean;
|
|
664
|
+
getAll(...keys: K): V[];
|
|
665
|
+
iterAll(...keys: K): IterableIterator<V>;
|
|
666
|
+
clear(): void;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* ```ts
|
|
670
|
+
* // Usage:
|
|
671
|
+
* const multi = asMulti(new Map2<string, string, number[]>());
|
|
672
|
+
* multi.add("A", "B", 5);
|
|
673
|
+
* ```
|
|
674
|
+
* @param base
|
|
675
|
+
* @returns
|
|
676
|
+
*/
|
|
677
|
+
declare function asMulti<K extends any[], EL>(base: KVComponent<K, EL[]>): MultiContainer<K, EL>;
|
|
678
|
+
|
|
679
|
+
export { Assert, Cookies, Device, IndexArray, type KVComponent, LRUCache, Map1, Map2, Map3, MultiContainer, SignedIndexArray, SmallIntCache, Stack, index as Utils, Vec2, asMulti };
|