@tspro/ts-utils-lib 1.1.0 → 1.2.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 +4 -0
- package/dist/index.d.mts +72 -71
- package/dist/index.d.ts +72 -71
- package/dist/index.js +37 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -31
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -11,20 +11,20 @@ declare function getRangeArray(start: number, end: number): number[];
|
|
|
11
11
|
declare function arrayContains<T extends unknown>(arg: T[], item: T): boolean;
|
|
12
12
|
declare function chunckArray<A>(arr: ReadonlyArray<A>, chunckSize: number): A[][];
|
|
13
13
|
|
|
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 const index$
|
|
26
|
-
declare namespace index$
|
|
27
|
-
export { index$
|
|
14
|
+
declare const index$7_arrayContains: typeof arrayContains;
|
|
15
|
+
declare const index$7_chunckArray: typeof chunckArray;
|
|
16
|
+
declare const index$7_duplicate: typeof duplicate;
|
|
17
|
+
declare const index$7_fillArray: typeof fillArray;
|
|
18
|
+
declare const index$7_getRangeArray: typeof getRangeArray;
|
|
19
|
+
declare const index$7_getSequenceArray: typeof getSequenceArray;
|
|
20
|
+
declare const index$7_isArray: typeof isArray;
|
|
21
|
+
declare const index$7_mapRangeArray: typeof mapRangeArray;
|
|
22
|
+
declare const index$7_mapSequenceArray: typeof mapSequenceArray;
|
|
23
|
+
declare const index$7_removeDuplicates: typeof removeDuplicates;
|
|
24
|
+
declare const index$7_removeDuplicatesCmp: typeof removeDuplicatesCmp;
|
|
25
|
+
declare const index$7_toArray: typeof toArray;
|
|
26
|
+
declare namespace index$7 {
|
|
27
|
+
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 };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
interface CSSProperties {
|
|
@@ -73,28 +73,28 @@ declare function getDimension(style?: CSSProperties): {
|
|
|
73
73
|
declare function styleLayoutChanged(style1?: CSSProperties, style2?: CSSProperties): boolean;
|
|
74
74
|
declare function getCanvasTextWidth(text: string, font: string): number;
|
|
75
75
|
|
|
76
|
-
type 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 const index$
|
|
96
|
-
declare namespace index$
|
|
97
|
-
export { type index$
|
|
76
|
+
type index$6_CSSProperties = CSSProperties;
|
|
77
|
+
declare const index$6_addClass: typeof addClass;
|
|
78
|
+
declare const index$6_appendTo: typeof appendTo;
|
|
79
|
+
declare const index$6_getButton: typeof getButton;
|
|
80
|
+
declare const index$6_getCanvas: typeof getCanvas;
|
|
81
|
+
declare const index$6_getCanvasTextWidth: typeof getCanvasTextWidth;
|
|
82
|
+
declare const index$6_getDimension: typeof getDimension;
|
|
83
|
+
declare const index$6_getHeight: typeof getHeight;
|
|
84
|
+
declare const index$6_getOffset: typeof getOffset;
|
|
85
|
+
declare const index$6_getPadding: typeof getPadding;
|
|
86
|
+
declare const index$6_getWidth: typeof getWidth;
|
|
87
|
+
declare const index$6_hasClass: typeof hasClass;
|
|
88
|
+
declare const index$6_removeClass: typeof removeClass;
|
|
89
|
+
declare const index$6_removeFromParent: typeof removeFromParent;
|
|
90
|
+
declare const index$6_setHeight: typeof setHeight;
|
|
91
|
+
declare const index$6_setOffset: typeof setOffset;
|
|
92
|
+
declare const index$6_setRect: typeof setRect;
|
|
93
|
+
declare const index$6_setVisibility: typeof setVisibility;
|
|
94
|
+
declare const index$6_setWidth: typeof setWidth;
|
|
95
|
+
declare const index$6_styleLayoutChanged: typeof styleLayoutChanged;
|
|
96
|
+
declare namespace index$6 {
|
|
97
|
+
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 };
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
type EnumObject = {
|
|
@@ -105,18 +105,18 @@ type EnumValue<E extends EnumObject> = E extends {
|
|
|
105
105
|
} ? V : never;
|
|
106
106
|
declare function getEnumValues<E extends EnumObject>(e: E): Array<EnumValue<E>>;
|
|
107
107
|
|
|
108
|
-
type index$
|
|
109
|
-
type index$
|
|
110
|
-
declare const index$
|
|
111
|
-
declare namespace index$
|
|
112
|
-
export { type index$
|
|
108
|
+
type index$5_EnumObject = EnumObject;
|
|
109
|
+
type index$5_EnumValue<E extends EnumObject> = EnumValue<E>;
|
|
110
|
+
declare const index$5_getEnumValues: typeof getEnumValues;
|
|
111
|
+
declare namespace index$5 {
|
|
112
|
+
export { type index$5_EnumObject as EnumObject, type index$5_EnumValue as EnumValue, index$5_getEnumValues as getEnumValues };
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
declare function getMapKeys<K, V>(map: Map<K, V>): K[];
|
|
116
116
|
|
|
117
|
-
declare const index$
|
|
118
|
-
declare namespace index$
|
|
119
|
-
export { index$
|
|
117
|
+
declare const index$4_getMapKeys: typeof getMapKeys;
|
|
118
|
+
declare namespace index$4 {
|
|
119
|
+
export { index$4_getMapKeys as getMapKeys };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
declare function isInteger(n: unknown): n is number;
|
|
@@ -140,25 +140,25 @@ declare function calcNormal(x1: number, y1: number, x2: number, y2: number): {
|
|
|
140
140
|
};
|
|
141
141
|
declare function sum(arr: number[]): number;
|
|
142
142
|
|
|
143
|
-
declare const index$
|
|
144
|
-
declare const index$
|
|
145
|
-
declare const index$
|
|
146
|
-
declare const index$
|
|
147
|
-
declare const index$
|
|
148
|
-
declare const index$
|
|
149
|
-
declare const index$
|
|
150
|
-
declare const index$
|
|
151
|
-
declare const index$
|
|
152
|
-
declare const index$
|
|
153
|
-
declare namespace index$
|
|
154
|
-
export { index$
|
|
143
|
+
declare const index$3_calcNormal: typeof calcNormal;
|
|
144
|
+
declare const index$3_clamp: typeof clamp;
|
|
145
|
+
declare const index$3_interpolateCoord: typeof interpolateCoord;
|
|
146
|
+
declare const index$3_interpolateY: typeof interpolateY;
|
|
147
|
+
declare const index$3_isInteger: typeof isInteger;
|
|
148
|
+
declare const index$3_linearToDecibels: typeof linearToDecibels;
|
|
149
|
+
declare const index$3_mod: typeof mod;
|
|
150
|
+
declare const index$3_romanize: typeof romanize;
|
|
151
|
+
declare const index$3_sum: typeof sum;
|
|
152
|
+
declare const index$3_toOrdinalNumber: typeof toOrdinalNumber;
|
|
153
|
+
declare namespace index$3 {
|
|
154
|
+
export { index$3_calcNormal as calcNormal, index$3_clamp as clamp, 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 };
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
158
158
|
|
|
159
|
-
declare const index$
|
|
160
|
-
declare namespace index$
|
|
161
|
-
export { index$
|
|
159
|
+
declare const index$2_isObject: typeof isObject;
|
|
160
|
+
declare namespace index$2 {
|
|
161
|
+
export { index$2_isObject as isObject };
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -207,25 +207,26 @@ declare function removeAt(str: string, pos: number, removeCount: number): string
|
|
|
207
207
|
*/
|
|
208
208
|
declare function makeSentenceFromPascal(PascalString: string): string;
|
|
209
209
|
|
|
210
|
-
declare const
|
|
211
|
-
declare const
|
|
212
|
-
declare const
|
|
213
|
-
declare const
|
|
214
|
-
declare const
|
|
215
|
-
declare const
|
|
216
|
-
declare const
|
|
217
|
-
declare namespace index {
|
|
218
|
-
export {
|
|
210
|
+
declare const index$1_chunkString: typeof chunkString;
|
|
211
|
+
declare const index$1_insertAt: typeof insertAt;
|
|
212
|
+
declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
|
|
213
|
+
declare const index$1_removeAt: typeof removeAt;
|
|
214
|
+
declare const index$1_repeatString: typeof repeatString;
|
|
215
|
+
declare const index$1_replaceAt: typeof replaceAt;
|
|
216
|
+
declare const index$1_toCharArray: typeof toCharArray;
|
|
217
|
+
declare namespace index$1 {
|
|
218
|
+
export { 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 };
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
declare namespace
|
|
222
|
-
export { index$
|
|
221
|
+
declare namespace index {
|
|
222
|
+
export { index$7 as Arr, index$6 as Dom, index$5 as Enum, index$4 as Map, index$3 as Math, index$2 as Obj, index$1 as Str };
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
declare namespace Assert {
|
|
226
226
|
type ErrorConstructor = new (msg: string) => Error;
|
|
227
227
|
function setErrorClass(ec?: ErrorConstructor): void;
|
|
228
228
|
function assert<T>(a: T, userMsg?: string): void;
|
|
229
|
+
function assertEnum<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): asserts value is E[keyof E];
|
|
229
230
|
function interrupt(userMsg?: string): never;
|
|
230
231
|
function int(a: unknown, userMsg?: string): number;
|
|
231
232
|
function eq<T>(a: T, b: T, userMsg?: string): T;
|
|
@@ -344,4 +345,4 @@ declare class SmallIntCache<V> {
|
|
|
344
345
|
clear(): void;
|
|
345
346
|
}
|
|
346
347
|
|
|
347
|
-
export { Assert, Cookies, Device, LRUCache, SmallIntCache, Stack,
|
|
348
|
+
export { Assert, Cookies, Device, LRUCache, SmallIntCache, Stack, index as Utils, Vec2 };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,20 +11,20 @@ declare function getRangeArray(start: number, end: number): number[];
|
|
|
11
11
|
declare function arrayContains<T extends unknown>(arg: T[], item: T): boolean;
|
|
12
12
|
declare function chunckArray<A>(arr: ReadonlyArray<A>, chunckSize: number): A[][];
|
|
13
13
|
|
|
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 const index$
|
|
26
|
-
declare namespace index$
|
|
27
|
-
export { index$
|
|
14
|
+
declare const index$7_arrayContains: typeof arrayContains;
|
|
15
|
+
declare const index$7_chunckArray: typeof chunckArray;
|
|
16
|
+
declare const index$7_duplicate: typeof duplicate;
|
|
17
|
+
declare const index$7_fillArray: typeof fillArray;
|
|
18
|
+
declare const index$7_getRangeArray: typeof getRangeArray;
|
|
19
|
+
declare const index$7_getSequenceArray: typeof getSequenceArray;
|
|
20
|
+
declare const index$7_isArray: typeof isArray;
|
|
21
|
+
declare const index$7_mapRangeArray: typeof mapRangeArray;
|
|
22
|
+
declare const index$7_mapSequenceArray: typeof mapSequenceArray;
|
|
23
|
+
declare const index$7_removeDuplicates: typeof removeDuplicates;
|
|
24
|
+
declare const index$7_removeDuplicatesCmp: typeof removeDuplicatesCmp;
|
|
25
|
+
declare const index$7_toArray: typeof toArray;
|
|
26
|
+
declare namespace index$7 {
|
|
27
|
+
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 };
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
interface CSSProperties {
|
|
@@ -73,28 +73,28 @@ declare function getDimension(style?: CSSProperties): {
|
|
|
73
73
|
declare function styleLayoutChanged(style1?: CSSProperties, style2?: CSSProperties): boolean;
|
|
74
74
|
declare function getCanvasTextWidth(text: string, font: string): number;
|
|
75
75
|
|
|
76
|
-
type 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 const index$
|
|
96
|
-
declare namespace index$
|
|
97
|
-
export { type index$
|
|
76
|
+
type index$6_CSSProperties = CSSProperties;
|
|
77
|
+
declare const index$6_addClass: typeof addClass;
|
|
78
|
+
declare const index$6_appendTo: typeof appendTo;
|
|
79
|
+
declare const index$6_getButton: typeof getButton;
|
|
80
|
+
declare const index$6_getCanvas: typeof getCanvas;
|
|
81
|
+
declare const index$6_getCanvasTextWidth: typeof getCanvasTextWidth;
|
|
82
|
+
declare const index$6_getDimension: typeof getDimension;
|
|
83
|
+
declare const index$6_getHeight: typeof getHeight;
|
|
84
|
+
declare const index$6_getOffset: typeof getOffset;
|
|
85
|
+
declare const index$6_getPadding: typeof getPadding;
|
|
86
|
+
declare const index$6_getWidth: typeof getWidth;
|
|
87
|
+
declare const index$6_hasClass: typeof hasClass;
|
|
88
|
+
declare const index$6_removeClass: typeof removeClass;
|
|
89
|
+
declare const index$6_removeFromParent: typeof removeFromParent;
|
|
90
|
+
declare const index$6_setHeight: typeof setHeight;
|
|
91
|
+
declare const index$6_setOffset: typeof setOffset;
|
|
92
|
+
declare const index$6_setRect: typeof setRect;
|
|
93
|
+
declare const index$6_setVisibility: typeof setVisibility;
|
|
94
|
+
declare const index$6_setWidth: typeof setWidth;
|
|
95
|
+
declare const index$6_styleLayoutChanged: typeof styleLayoutChanged;
|
|
96
|
+
declare namespace index$6 {
|
|
97
|
+
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 };
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
type EnumObject = {
|
|
@@ -105,18 +105,18 @@ type EnumValue<E extends EnumObject> = E extends {
|
|
|
105
105
|
} ? V : never;
|
|
106
106
|
declare function getEnumValues<E extends EnumObject>(e: E): Array<EnumValue<E>>;
|
|
107
107
|
|
|
108
|
-
type index$
|
|
109
|
-
type index$
|
|
110
|
-
declare const index$
|
|
111
|
-
declare namespace index$
|
|
112
|
-
export { type index$
|
|
108
|
+
type index$5_EnumObject = EnumObject;
|
|
109
|
+
type index$5_EnumValue<E extends EnumObject> = EnumValue<E>;
|
|
110
|
+
declare const index$5_getEnumValues: typeof getEnumValues;
|
|
111
|
+
declare namespace index$5 {
|
|
112
|
+
export { type index$5_EnumObject as EnumObject, type index$5_EnumValue as EnumValue, index$5_getEnumValues as getEnumValues };
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
declare function getMapKeys<K, V>(map: Map<K, V>): K[];
|
|
116
116
|
|
|
117
|
-
declare const index$
|
|
118
|
-
declare namespace index$
|
|
119
|
-
export { index$
|
|
117
|
+
declare const index$4_getMapKeys: typeof getMapKeys;
|
|
118
|
+
declare namespace index$4 {
|
|
119
|
+
export { index$4_getMapKeys as getMapKeys };
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
declare function isInteger(n: unknown): n is number;
|
|
@@ -140,25 +140,25 @@ declare function calcNormal(x1: number, y1: number, x2: number, y2: number): {
|
|
|
140
140
|
};
|
|
141
141
|
declare function sum(arr: number[]): number;
|
|
142
142
|
|
|
143
|
-
declare const index$
|
|
144
|
-
declare const index$
|
|
145
|
-
declare const index$
|
|
146
|
-
declare const index$
|
|
147
|
-
declare const index$
|
|
148
|
-
declare const index$
|
|
149
|
-
declare const index$
|
|
150
|
-
declare const index$
|
|
151
|
-
declare const index$
|
|
152
|
-
declare const index$
|
|
153
|
-
declare namespace index$
|
|
154
|
-
export { index$
|
|
143
|
+
declare const index$3_calcNormal: typeof calcNormal;
|
|
144
|
+
declare const index$3_clamp: typeof clamp;
|
|
145
|
+
declare const index$3_interpolateCoord: typeof interpolateCoord;
|
|
146
|
+
declare const index$3_interpolateY: typeof interpolateY;
|
|
147
|
+
declare const index$3_isInteger: typeof isInteger;
|
|
148
|
+
declare const index$3_linearToDecibels: typeof linearToDecibels;
|
|
149
|
+
declare const index$3_mod: typeof mod;
|
|
150
|
+
declare const index$3_romanize: typeof romanize;
|
|
151
|
+
declare const index$3_sum: typeof sum;
|
|
152
|
+
declare const index$3_toOrdinalNumber: typeof toOrdinalNumber;
|
|
153
|
+
declare namespace index$3 {
|
|
154
|
+
export { index$3_calcNormal as calcNormal, index$3_clamp as clamp, 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 };
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
158
158
|
|
|
159
|
-
declare const index$
|
|
160
|
-
declare namespace index$
|
|
161
|
-
export { index$
|
|
159
|
+
declare const index$2_isObject: typeof isObject;
|
|
160
|
+
declare namespace index$2 {
|
|
161
|
+
export { index$2_isObject as isObject };
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -207,25 +207,26 @@ declare function removeAt(str: string, pos: number, removeCount: number): string
|
|
|
207
207
|
*/
|
|
208
208
|
declare function makeSentenceFromPascal(PascalString: string): string;
|
|
209
209
|
|
|
210
|
-
declare const
|
|
211
|
-
declare const
|
|
212
|
-
declare const
|
|
213
|
-
declare const
|
|
214
|
-
declare const
|
|
215
|
-
declare const
|
|
216
|
-
declare const
|
|
217
|
-
declare namespace index {
|
|
218
|
-
export {
|
|
210
|
+
declare const index$1_chunkString: typeof chunkString;
|
|
211
|
+
declare const index$1_insertAt: typeof insertAt;
|
|
212
|
+
declare const index$1_makeSentenceFromPascal: typeof makeSentenceFromPascal;
|
|
213
|
+
declare const index$1_removeAt: typeof removeAt;
|
|
214
|
+
declare const index$1_repeatString: typeof repeatString;
|
|
215
|
+
declare const index$1_replaceAt: typeof replaceAt;
|
|
216
|
+
declare const index$1_toCharArray: typeof toCharArray;
|
|
217
|
+
declare namespace index$1 {
|
|
218
|
+
export { 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 };
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
-
declare namespace
|
|
222
|
-
export { index$
|
|
221
|
+
declare namespace index {
|
|
222
|
+
export { index$7 as Arr, index$6 as Dom, index$5 as Enum, index$4 as Map, index$3 as Math, index$2 as Obj, index$1 as Str };
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
declare namespace Assert {
|
|
226
226
|
type ErrorConstructor = new (msg: string) => Error;
|
|
227
227
|
function setErrorClass(ec?: ErrorConstructor): void;
|
|
228
228
|
function assert<T>(a: T, userMsg?: string): void;
|
|
229
|
+
function assertEnum<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): asserts value is E[keyof E];
|
|
229
230
|
function interrupt(userMsg?: string): never;
|
|
230
231
|
function int(a: unknown, userMsg?: string): number;
|
|
231
232
|
function eq<T>(a: T, b: T, userMsg?: string): T;
|
|
@@ -344,4 +345,4 @@ declare class SmallIntCache<V> {
|
|
|
344
345
|
clear(): void;
|
|
345
346
|
}
|
|
346
347
|
|
|
347
|
-
export { Assert, Cookies, Device, LRUCache, SmallIntCache, Stack,
|
|
348
|
+
export { Assert, Cookies, Device, LRUCache, SmallIntCache, Stack, index as Utils, Vec2 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* TsUtilsLib v1.0
|
|
1
|
+
/* TsUtilsLib v1.2.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -29,26 +29,26 @@ __export(index_exports, {
|
|
|
29
29
|
LRUCache: () => LRUCache,
|
|
30
30
|
SmallIntCache: () => SmallIntCache,
|
|
31
31
|
Stack: () => Stack,
|
|
32
|
-
Utils: () =>
|
|
32
|
+
Utils: () => utils_exports,
|
|
33
33
|
Vec2: () => Vec2
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
|
-
// src/
|
|
38
|
-
var
|
|
39
|
-
__export(
|
|
40
|
-
Arr: () =>
|
|
37
|
+
// src/utils/index.ts
|
|
38
|
+
var utils_exports = {};
|
|
39
|
+
__export(utils_exports, {
|
|
40
|
+
Arr: () => arr_exports,
|
|
41
41
|
Dom: () => dom_exports,
|
|
42
42
|
Enum: () => enum_exports,
|
|
43
43
|
Map: () => map_exports,
|
|
44
44
|
Math: () => math_exports,
|
|
45
|
-
Obj: () =>
|
|
46
|
-
Str: () =>
|
|
45
|
+
Obj: () => obj_exports,
|
|
46
|
+
Str: () => str_exports
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
// src/
|
|
50
|
-
var
|
|
51
|
-
__export(
|
|
49
|
+
// src/utils/arr/index.ts
|
|
50
|
+
var arr_exports = {};
|
|
51
|
+
__export(arr_exports, {
|
|
52
52
|
arrayContains: () => arrayContains,
|
|
53
53
|
chunckArray: () => chunckArray,
|
|
54
54
|
duplicate: () => duplicate,
|
|
@@ -63,7 +63,7 @@ __export(array_exports, {
|
|
|
63
63
|
toArray: () => toArray
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
-
// src/math/index.ts
|
|
66
|
+
// src/utils/math/index.ts
|
|
67
67
|
var math_exports = {};
|
|
68
68
|
__export(math_exports, {
|
|
69
69
|
calcNormal: () => calcNormal,
|
|
@@ -181,7 +181,7 @@ function sum(arr) {
|
|
|
181
181
|
return arr.reduce((prev, cur) => cur + prev, 0);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
// src/
|
|
184
|
+
// src/utils/arr/index.ts
|
|
185
185
|
function isArray(a) {
|
|
186
186
|
return !!a && Object.prototype.toString.call(a) === "[object Array]";
|
|
187
187
|
}
|
|
@@ -247,7 +247,7 @@ function chunckArray(arr, chunckSize) {
|
|
|
247
247
|
return result;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
// src/dom/index.ts
|
|
250
|
+
// src/utils/dom/index.ts
|
|
251
251
|
var dom_exports = {};
|
|
252
252
|
__export(dom_exports, {
|
|
253
253
|
addClass: () => addClass,
|
|
@@ -271,6 +271,15 @@ __export(dom_exports, {
|
|
|
271
271
|
styleLayoutChanged: () => styleLayoutChanged
|
|
272
272
|
});
|
|
273
273
|
|
|
274
|
+
// src/utils/enum/index.ts
|
|
275
|
+
var enum_exports = {};
|
|
276
|
+
__export(enum_exports, {
|
|
277
|
+
getEnumValues: () => getEnumValues
|
|
278
|
+
});
|
|
279
|
+
function getEnumValues(e) {
|
|
280
|
+
return Object.keys(e).filter((key) => Number.isNaN(Number(key))).map((key) => e[key]);
|
|
281
|
+
}
|
|
282
|
+
|
|
274
283
|
// src/modules/assert.ts
|
|
275
284
|
var Assert;
|
|
276
285
|
((Assert2) => {
|
|
@@ -294,6 +303,12 @@ var Assert;
|
|
|
294
303
|
}
|
|
295
304
|
}
|
|
296
305
|
Assert2.assert = assert;
|
|
306
|
+
function assertEnum(value, enumObj, name = "value") {
|
|
307
|
+
if (!getEnumValues(enumObj).some((v) => v === value)) {
|
|
308
|
+
throw new TypeError(`Invalid ${name} enum value: ${value}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
Assert2.assertEnum = assertEnum;
|
|
297
312
|
function interrupt(userMsg) {
|
|
298
313
|
throwError(userMsg ?? "Interrupted!");
|
|
299
314
|
}
|
|
@@ -516,7 +531,7 @@ var Device;
|
|
|
516
531
|
Device2.toPx = toPx2;
|
|
517
532
|
})(Device || (Device = {}));
|
|
518
533
|
|
|
519
|
-
// src/dom/index.ts
|
|
534
|
+
// src/utils/dom/index.ts
|
|
520
535
|
function toPx(value) {
|
|
521
536
|
return value === void 0 ? void 0 : Device.toPx(value);
|
|
522
537
|
}
|
|
@@ -684,16 +699,7 @@ function getCanvasTextWidth(text, font) {
|
|
|
684
699
|
return ctx.measureText(text).width;
|
|
685
700
|
}
|
|
686
701
|
|
|
687
|
-
// src/
|
|
688
|
-
var enum_exports = {};
|
|
689
|
-
__export(enum_exports, {
|
|
690
|
-
getEnumValues: () => getEnumValues
|
|
691
|
-
});
|
|
692
|
-
function getEnumValues(e) {
|
|
693
|
-
return Object.keys(e).filter((key) => Number.isNaN(Number(key))).map((key) => e[key]);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
// src/map/index.ts
|
|
702
|
+
// src/utils/map/index.ts
|
|
697
703
|
var map_exports = {};
|
|
698
704
|
__export(map_exports, {
|
|
699
705
|
getMapKeys: () => getMapKeys
|
|
@@ -704,18 +710,18 @@ function getMapKeys(map) {
|
|
|
704
710
|
return keys;
|
|
705
711
|
}
|
|
706
712
|
|
|
707
|
-
// src/
|
|
708
|
-
var
|
|
709
|
-
__export(
|
|
713
|
+
// src/utils/obj/index.ts
|
|
714
|
+
var obj_exports = {};
|
|
715
|
+
__export(obj_exports, {
|
|
710
716
|
isObject: () => isObject
|
|
711
717
|
});
|
|
712
718
|
function isObject(value) {
|
|
713
719
|
return typeof value === "object" && value !== null && !isArray(value);
|
|
714
720
|
}
|
|
715
721
|
|
|
716
|
-
// src/
|
|
717
|
-
var
|
|
718
|
-
__export(
|
|
722
|
+
// src/utils/str/index.ts
|
|
723
|
+
var str_exports = {};
|
|
724
|
+
__export(str_exports, {
|
|
719
725
|
chunkString: () => chunkString,
|
|
720
726
|
insertAt: () => insertAt,
|
|
721
727
|
makeSentenceFromPascal: () => makeSentenceFromPascal,
|