@tspro/ts-utils-lib 1.14.0 → 1.16.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 +15 -0
- package/README.md +10 -4
- package/dist/index.d.mts +253 -138
- package/dist/index.d.ts +253 -138
- package/dist/index.js +813 -453
- package/dist/index.mjs +809 -452
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.16.0] - 2025-10-20
|
|
4
|
+
### Added
|
|
5
|
+
- Add isEmpty() to interface and containers.
|
|
6
|
+
- Add more functions and iterators to MultiContainer.
|
|
7
|
+
|
|
8
|
+
## [1.15.0] - 2025-10-20
|
|
9
|
+
### Added
|
|
10
|
+
- SignedIndexArray.equals()
|
|
11
|
+
- class IndexArray<EL>, same as SignedIndexArray but for non-negative indices.
|
|
12
|
+
- Added KVComponent interface for Map1, Map2, Map3, IndexArray and SignedIndexArray.
|
|
13
|
+
- Added MultiContainer.
|
|
14
|
+
|
|
15
|
+
## Deprecate
|
|
16
|
+
- SmallIntCache, use SignedIndexArray has same functionality and more.
|
|
17
|
+
|
|
3
18
|
## [1.14.0] - 2025-10-19
|
|
4
19
|
### Added
|
|
5
20
|
- 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,88 @@ declare class SmallIntCache<V> {
|
|
|
446
450
|
clear(): void;
|
|
447
451
|
}
|
|
448
452
|
|
|
453
|
+
interface KVComponent<K extends any[], EL> {
|
|
454
|
+
get size(): number;
|
|
455
|
+
isEmpty(): boolean;
|
|
456
|
+
has(...keys: K): boolean;
|
|
457
|
+
get(...keys: K): EL | undefined;
|
|
458
|
+
getOrDefault(...keysAndDefault: [...K, EL]): EL;
|
|
459
|
+
getOrCreate(...keysAndCreator: [...K, EL]): EL;
|
|
460
|
+
set(...keysAndValue: [...K, EL]): void;
|
|
461
|
+
delete(...keys: K): boolean;
|
|
462
|
+
clear?(): void;
|
|
463
|
+
toString(): string;
|
|
464
|
+
kvValues(): IterableIterator<EL>;
|
|
465
|
+
kvKeys(): IterableIterator<K>;
|
|
466
|
+
kvEntries(): IterableIterator<[K, EL]>;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* An array-like structure for non-negative indexes.
|
|
471
|
+
*/
|
|
472
|
+
declare class IndexArray<EL> implements KVComponent<[number], EL> {
|
|
473
|
+
private static toNegIndex;
|
|
474
|
+
private static validateIndex;
|
|
475
|
+
private posEl;
|
|
476
|
+
private hasPos;
|
|
477
|
+
private elCount;
|
|
478
|
+
constructor();
|
|
479
|
+
constructor(arr: IndexArray<EL>);
|
|
480
|
+
constructor(entries: Iterable<[number, EL]>);
|
|
481
|
+
private get posLen();
|
|
482
|
+
get size(): number;
|
|
483
|
+
isEmpty(): boolean;
|
|
484
|
+
has(id: number): boolean;
|
|
485
|
+
set(id: number, el: EL): void;
|
|
486
|
+
get(id: number): EL | undefined;
|
|
487
|
+
getOrDefault(id: number, defaultValue: EL): EL;
|
|
488
|
+
getOrCreate(id: number, value: EL): EL;
|
|
489
|
+
getOrCreate(id: number, creator: () => EL): EL;
|
|
490
|
+
delete(id: number): boolean;
|
|
491
|
+
clear(): void;
|
|
492
|
+
forEach(callbackfn: (el: EL, id: number, arr: IndexArray<EL>) => void, thisArg?: any): void;
|
|
493
|
+
indices(): IterableIterator<number>;
|
|
494
|
+
values(): IterableIterator<EL>;
|
|
495
|
+
entries(): IterableIterator<[number, EL]>;
|
|
496
|
+
indicesArray(): number[];
|
|
497
|
+
valuesArray(): EL[];
|
|
498
|
+
entriesArray(): [number, EL][];
|
|
499
|
+
kvKeys(): IterableIterator<[number]>;
|
|
500
|
+
kvValues(): IterableIterator<EL>;
|
|
501
|
+
kvEntries(): IterableIterator<[[number], EL]>;
|
|
502
|
+
[Symbol.iterator](): Generator<[number, EL], void, any>;
|
|
503
|
+
clone(): IndexArray<EL>;
|
|
504
|
+
merge(other: IndexArray<EL>, conflictResolver?: (oldValue: EL, newValue: EL, id: number) => EL): this;
|
|
505
|
+
some(fn: (el: EL, id: number) => boolean): boolean;
|
|
506
|
+
every(fn: (value: EL, key1: number) => boolean): boolean;
|
|
507
|
+
filter(fn: (value: EL, key1: number) => boolean): IndexArray<EL>;
|
|
508
|
+
reduce(fn: (acc: EL, el: EL, id: number) => EL): EL;
|
|
509
|
+
reduce<R>(fn: (acc: R, el: EL, id: number) => R, init: R): R;
|
|
510
|
+
mapToArray<R>(fn: (value: EL, key1: number) => R): R[];
|
|
511
|
+
map<R = EL>(fn: (value: EL, key1: number) => R): IndexArray<R>;
|
|
512
|
+
equals(other: IndexArray<EL>): boolean;
|
|
513
|
+
equals(other: IndexArray<EL>, eq: (a: EL, b: EL) => boolean): boolean;
|
|
514
|
+
toString(): string;
|
|
515
|
+
}
|
|
516
|
+
|
|
449
517
|
/**
|
|
450
518
|
* An array-like structure for signed indexes, including negatives.
|
|
451
519
|
*/
|
|
452
|
-
declare class SignedIndexArray<EL> {
|
|
520
|
+
declare class SignedIndexArray<EL> implements KVComponent<[number], EL> {
|
|
521
|
+
private static toNegIndex;
|
|
522
|
+
private static validateIndex;
|
|
453
523
|
private posEl;
|
|
454
524
|
private hasPos;
|
|
455
525
|
private negEl;
|
|
456
526
|
private hasNeg;
|
|
457
527
|
private elCount;
|
|
458
|
-
private static toNegIndex;
|
|
459
528
|
constructor();
|
|
460
529
|
constructor(arr: SignedIndexArray<EL>);
|
|
461
530
|
constructor(entries: Iterable<[number, EL]>);
|
|
462
531
|
get size(): number;
|
|
532
|
+
isEmpty(): boolean;
|
|
533
|
+
private get posLen();
|
|
534
|
+
private get negLen();
|
|
463
535
|
has(id: number): boolean;
|
|
464
536
|
set(id: number, el: EL): void;
|
|
465
537
|
get(id: number): EL | undefined;
|
|
@@ -470,11 +542,14 @@ declare class SignedIndexArray<EL> {
|
|
|
470
542
|
clear(): void;
|
|
471
543
|
forEach(callbackfn: (el: EL, id: number, arr: SignedIndexArray<EL>) => void, thisArg?: any): void;
|
|
472
544
|
indices(): IterableIterator<number>;
|
|
473
|
-
indicesArray(): number[];
|
|
474
545
|
values(): IterableIterator<EL>;
|
|
475
|
-
valuesArray(): EL[];
|
|
476
546
|
entries(): IterableIterator<[number, EL]>;
|
|
547
|
+
indicesArray(): number[];
|
|
548
|
+
valuesArray(): EL[];
|
|
477
549
|
entriesArray(): [number, EL][];
|
|
550
|
+
kvKeys(): IterableIterator<[number]>;
|
|
551
|
+
kvValues(): IterableIterator<EL>;
|
|
552
|
+
kvEntries(): IterableIterator<[[number], EL]>;
|
|
478
553
|
[Symbol.iterator](): Generator<[number, EL], void, any>;
|
|
479
554
|
clone(): SignedIndexArray<EL>;
|
|
480
555
|
merge(other: SignedIndexArray<EL>, conflictResolver?: (oldValue: EL, newValue: EL, id: number) => EL): this;
|
|
@@ -485,10 +560,12 @@ declare class SignedIndexArray<EL> {
|
|
|
485
560
|
reduce<R>(fn: (acc: R, el: EL, id: number) => R, init: R): R;
|
|
486
561
|
mapToArray<R>(fn: (value: EL, key1: number) => R): R[];
|
|
487
562
|
map<R = EL>(fn: (value: EL, key1: number) => R): SignedIndexArray<R>;
|
|
563
|
+
equals(other: SignedIndexArray<EL>): boolean;
|
|
564
|
+
equals(other: SignedIndexArray<EL>, eq: (a: EL, b: EL) => boolean): boolean;
|
|
488
565
|
toString(): string;
|
|
489
566
|
}
|
|
490
567
|
|
|
491
|
-
declare class Map1<KEY1, VALUE> {
|
|
568
|
+
declare class Map1<KEY1, VALUE> implements KVComponent<[KEY1], VALUE> {
|
|
492
569
|
private map1;
|
|
493
570
|
constructor();
|
|
494
571
|
constructor(map1: Map1<KEY1, VALUE>);
|
|
@@ -502,13 +579,17 @@ declare class Map1<KEY1, VALUE> {
|
|
|
502
579
|
delete(key1: KEY1): boolean;
|
|
503
580
|
clear(): void;
|
|
504
581
|
get size(): number;
|
|
582
|
+
isEmpty(): boolean;
|
|
505
583
|
forEach(callbackfn: (value: VALUE, key1: KEY1, map1: Map1<KEY1, VALUE>) => void, thisArg?: any): void;
|
|
506
584
|
keys(): IterableIterator<KEY1>;
|
|
507
|
-
keysArray(): KEY1[];
|
|
508
585
|
values(): IterableIterator<VALUE>;
|
|
509
|
-
valuesArray(): VALUE[];
|
|
510
586
|
entries(): IterableIterator<[KEY1, VALUE]>;
|
|
587
|
+
keysArray(): KEY1[];
|
|
588
|
+
valuesArray(): VALUE[];
|
|
511
589
|
entriesArray(): [KEY1, VALUE][];
|
|
590
|
+
kvKeys(): IterableIterator<[KEY1]>;
|
|
591
|
+
kvValues(): IterableIterator<VALUE>;
|
|
592
|
+
kvEntries(): IterableIterator<[[KEY1], VALUE]>;
|
|
512
593
|
[Symbol.iterator](): Generator<[KEY1, VALUE], void, any>;
|
|
513
594
|
clone(): Map1<KEY1, VALUE>;
|
|
514
595
|
merge(other: Map1<KEY1, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1) => VALUE): this;
|
|
@@ -521,7 +602,7 @@ declare class Map1<KEY1, VALUE> {
|
|
|
521
602
|
toMap(): Map<KEY1, VALUE>;
|
|
522
603
|
toString(): string;
|
|
523
604
|
}
|
|
524
|
-
declare class Map2<KEY1, KEY2, VALUE> {
|
|
605
|
+
declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
525
606
|
private map1;
|
|
526
607
|
constructor();
|
|
527
608
|
constructor(map2: Map2<KEY1, KEY2, VALUE>);
|
|
@@ -536,13 +617,17 @@ declare class Map2<KEY1, KEY2, VALUE> {
|
|
|
536
617
|
delete(key1: KEY1, key2: KEY2): boolean;
|
|
537
618
|
clear(): void;
|
|
538
619
|
get size(): number;
|
|
620
|
+
isEmpty(): boolean;
|
|
539
621
|
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, map2: Map2<KEY1, KEY2, VALUE>) => void, thisArg?: any): void;
|
|
540
622
|
keys(): IterableIterator<[KEY1, KEY2]>;
|
|
541
|
-
keysArray(): [KEY1, KEY2][];
|
|
542
623
|
values(): IterableIterator<VALUE>;
|
|
543
|
-
valuesArray(): VALUE[];
|
|
544
624
|
entries(): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
625
|
+
keysArray(): [KEY1, KEY2][];
|
|
626
|
+
valuesArray(): VALUE[];
|
|
545
627
|
entriesArray(): [KEY1, KEY2, VALUE][];
|
|
628
|
+
kvKeys(): IterableIterator<[KEY1, KEY2]>;
|
|
629
|
+
kvValues(): IterableIterator<VALUE>;
|
|
630
|
+
kvEntries(): IterableIterator<[[KEY1, KEY2], VALUE]>;
|
|
546
631
|
[Symbol.iterator](): Generator<[KEY1, KEY2, VALUE], void, any>;
|
|
547
632
|
clone(): Map2<KEY1, KEY2, VALUE>;
|
|
548
633
|
merge(other: Map2<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
@@ -555,7 +640,7 @@ declare class Map2<KEY1, KEY2, VALUE> {
|
|
|
555
640
|
toMap(): Map<[KEY1, KEY2], VALUE>;
|
|
556
641
|
toString(): string;
|
|
557
642
|
}
|
|
558
|
-
declare class Map3<KEY1, KEY2, KEY3, VALUE> {
|
|
643
|
+
declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
559
644
|
private map1;
|
|
560
645
|
constructor();
|
|
561
646
|
constructor(entries: Iterable<[KEY1, KEY2, KEY3, VALUE]>);
|
|
@@ -571,13 +656,17 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> {
|
|
|
571
656
|
delete(key1: KEY1, key2: KEY2, key3: KEY3): boolean;
|
|
572
657
|
clear(): void;
|
|
573
658
|
get size(): number;
|
|
659
|
+
isEmpty(): boolean;
|
|
574
660
|
forEach(callbackfn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3, map2: Map3<KEY1, KEY2, KEY3, VALUE>) => void, thisArg?: any): void;
|
|
575
661
|
keys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
576
|
-
keysArray(): [KEY1, KEY2, KEY3][];
|
|
577
662
|
values(): IterableIterator<VALUE>;
|
|
578
|
-
valuesArray(): VALUE[];
|
|
579
663
|
entries(): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
664
|
+
keysArray(): [KEY1, KEY2, KEY3][];
|
|
665
|
+
valuesArray(): VALUE[];
|
|
580
666
|
entriesArray(): [KEY1, KEY2, KEY3, VALUE][];
|
|
667
|
+
kvKeys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
668
|
+
kvValues(): IterableIterator<VALUE>;
|
|
669
|
+
kvEntries(): IterableIterator<[[KEY1, KEY2, KEY3], VALUE]>;
|
|
581
670
|
[Symbol.iterator](): Generator<[KEY1, KEY2, KEY3, VALUE], void, any>;
|
|
582
671
|
clone(): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
583
672
|
merge(other: Map3<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
@@ -591,4 +680,30 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> {
|
|
|
591
680
|
toString(): string;
|
|
592
681
|
}
|
|
593
682
|
|
|
594
|
-
|
|
683
|
+
declare class MultiContainer<K extends any[], V> {
|
|
684
|
+
private readonly base;
|
|
685
|
+
constructor(base: KVComponent<K, V[]>);
|
|
686
|
+
isEmpty(): boolean;
|
|
687
|
+
clear(): void;
|
|
688
|
+
add(...keysAndValue: [...K, V]): V;
|
|
689
|
+
remove(...keysAndValue: [...K, V]): boolean;
|
|
690
|
+
getAll(...keys: K): V[];
|
|
691
|
+
iterAll(...keys: K): IterableIterator<V>;
|
|
692
|
+
values(): IterableIterator<V>;
|
|
693
|
+
keys(): IterableIterator<K>;
|
|
694
|
+
entries(): IterableIterator<[K, V[]]>;
|
|
695
|
+
[Symbol.iterator](): IterableIterator<[K, V[]]>;
|
|
696
|
+
toString(): string;
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* ```ts
|
|
700
|
+
* // Usage:
|
|
701
|
+
* const multi = asMulti(new Map2<string, string, number[]>());
|
|
702
|
+
* multi.add("A", "B", 5);
|
|
703
|
+
* ```
|
|
704
|
+
* @param base
|
|
705
|
+
* @returns
|
|
706
|
+
*/
|
|
707
|
+
declare function asMulti<K extends any[], EL>(base: KVComponent<K, EL[]>): MultiContainer<K, EL>;
|
|
708
|
+
|
|
709
|
+
export { Assert, Cookies, Device, IndexArray, type KVComponent, LRUCache, Map1, Map2, Map3, MultiContainer, SignedIndexArray, SmallIntCache, Stack, index as Utils, Vec2, asMulti };
|