@tspro/ts-utils-lib 1.17.0 → 1.19.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 +20 -0
- package/README.md +4 -4
- package/dist/index.d.mts +470 -177
- package/dist/index.d.ts +470 -177
- package/dist/index.js +1144 -609
- package/dist/index.mjs +1143 -609
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,276 @@
|
|
|
1
|
+
type EnumObject = Record<string, string | number>;
|
|
2
|
+
type EnumKey<E extends EnumObject> = keyof E;
|
|
3
|
+
type EnumValue<E extends EnumObject> = E[EnumKey<E>];
|
|
4
|
+
declare function getEnumKeys<E extends EnumObject>(e: E): EnumKey<E>[];
|
|
5
|
+
declare function getEnumValues<E extends EnumObject>(e: E): EnumValue<E>[];
|
|
6
|
+
declare function getEnumEntries<E extends EnumObject>(e: E): [keyof E, EnumValue<E>][];
|
|
7
|
+
declare function getEnumKey<E extends EnumObject>(e: E, value: EnumValue<E>): keyof E | undefined;
|
|
8
|
+
declare function forEachEnum<E extends EnumObject>(e: E, callback: (key: keyof E, value: E[keyof E]) => void): void;
|
|
9
|
+
declare function isEnumValue$2<E extends EnumObject>(e: E, value: unknown): value is EnumValue<E>;
|
|
10
|
+
declare function assertEnumValue<E extends EnumObject>(e: E, value: unknown): asserts value is EnumValue<E>;
|
|
11
|
+
|
|
12
|
+
type index$8_EnumKey<E extends EnumObject> = EnumKey<E>;
|
|
13
|
+
type index$8_EnumObject = EnumObject;
|
|
14
|
+
type index$8_EnumValue<E extends EnumObject> = EnumValue<E>;
|
|
15
|
+
declare const index$8_assertEnumValue: typeof assertEnumValue;
|
|
16
|
+
declare const index$8_forEachEnum: typeof forEachEnum;
|
|
17
|
+
declare const index$8_getEnumEntries: typeof getEnumEntries;
|
|
18
|
+
declare const index$8_getEnumKey: typeof getEnumKey;
|
|
19
|
+
declare const index$8_getEnumKeys: typeof getEnumKeys;
|
|
20
|
+
declare const index$8_getEnumValues: typeof getEnumValues;
|
|
21
|
+
declare namespace index$8 {
|
|
22
|
+
export { type index$8_EnumKey as EnumKey, type index$8_EnumObject as EnumObject, type index$8_EnumValue as EnumValue, index$8_assertEnumValue as assertEnumValue, index$8_forEachEnum as forEachEnum, index$8_getEnumEntries as getEnumEntries, index$8_getEnumKey as getEnumKey, index$8_getEnumKeys as getEnumKeys, index$8_getEnumValues as getEnumValues, isEnumValue$2 as isEnumValue };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type ErrorConstructor = new (msg: string) => Error;
|
|
26
|
+
declare function setErrorClass(errorClass?: ErrorConstructor): void;
|
|
27
|
+
/** @deprecated */
|
|
28
|
+
declare function interrupt(msg?: string): never;
|
|
29
|
+
/** @deprecated */
|
|
30
|
+
declare function assertEnum<E extends EnumObject>(enumVal: unknown, enumObj: E, name?: string): asserts enumVal is E[keyof E];
|
|
31
|
+
/** @deprecated */
|
|
32
|
+
declare function int(value: unknown, msg?: string): number;
|
|
33
|
+
/** @deprecated */
|
|
34
|
+
declare function eq<T>(value1: T, value2: T, msg?: string): T;
|
|
35
|
+
/** @deprecated */
|
|
36
|
+
declare function int_eq(value: unknown, compareTo: unknown, msg?: string): number;
|
|
37
|
+
/** @deprecated */
|
|
38
|
+
declare function int_lt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
39
|
+
/** @deprecated */
|
|
40
|
+
declare function int_lte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
41
|
+
/** @deprecated */
|
|
42
|
+
declare function int_gt(value: unknown, compareTo: unknown, msg?: string): number;
|
|
43
|
+
/** @deprecated */
|
|
44
|
+
declare function int_gte(value: unknown, compareTo: unknown, msg?: string): number;
|
|
45
|
+
/** @deprecated */
|
|
46
|
+
declare function int_between(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
47
|
+
/** @deprecated */
|
|
48
|
+
declare function int_between_exclusive(value: unknown, min: unknown, max: unknown, msg?: string): number;
|
|
49
|
+
/** @deprecated */
|
|
50
|
+
declare function odd(value: unknown, msg?: string): number;
|
|
51
|
+
/** @deprecated */
|
|
52
|
+
declare function even(value: unknown, msg?: string): number;
|
|
53
|
+
/** @deprecated */
|
|
54
|
+
declare function in_group<T>(value: T, group: ReadonlyArray<T>, msg?: string): T;
|
|
55
|
+
/** @deprecated */
|
|
56
|
+
declare function finite(value: unknown, msg?: string): number;
|
|
57
|
+
/** @deprecated */
|
|
58
|
+
declare function array_id<T>(array: Readonly<T[]>, index: unknown, msg?: string): number;
|
|
59
|
+
/** @deprecated */
|
|
60
|
+
declare function array_elem<T>(array: Readonly<T[]>, index: number, msg?: string): T;
|
|
61
|
+
declare function assert<T>(condition: T, msg?: string): void;
|
|
62
|
+
declare function require<T>(value: T | null | undefined, msg?: string): T;
|
|
63
|
+
declare function requireDefined<T>(value: T | undefined, msg?: string): T;
|
|
64
|
+
declare function fail(msg?: string): never;
|
|
65
|
+
declare function isEqual$1(value1: unknown, value2: unknown, msg?: string): boolean;
|
|
66
|
+
declare function isDeepEqual$1(value1: unknown, value2: unknown, msg?: string): boolean;
|
|
67
|
+
declare function isUndefined$1(value: unknown, msg?: string): value is undefined;
|
|
68
|
+
declare function isNull$1(value: unknown, msg?: string): value is null;
|
|
69
|
+
declare function isNullish$1(value: unknown, msg?: string): value is null | undefined;
|
|
70
|
+
declare function isObject$1(value: unknown, msg?: string): value is Record<string, unknown>;
|
|
71
|
+
declare function isObjectOrUndefined$1(value: unknown, msg?: string): value is Record<string, unknown> | undefined;
|
|
72
|
+
declare function isTypedObject$1<T extends object>(obj: unknown, keys: (keyof T)[], msg?: string): obj is HasProps<T>;
|
|
73
|
+
declare function isArray$1<T>(value: T[] | unknown, msg?: string): value is T[];
|
|
74
|
+
declare function isArrayOrUndefined$1(value: unknown, msg?: string): value is unknown[] | undefined;
|
|
75
|
+
declare function isEmptyArray$1<T>(value: T[] | unknown, msg?: string): value is T[];
|
|
76
|
+
declare function isNonEmptyArray$1<T>(value: T[] | unknown, msg?: string): value is T[];
|
|
77
|
+
declare function isEmptyArrayOrUndefined$1<T>(value: T[] | unknown, msg?: string): value is T[] | undefined;
|
|
78
|
+
declare function isNonEmptyArrayOrUndefined$1<T>(value: T[] | unknown, msg?: string): value is T[] | undefined;
|
|
79
|
+
declare function isString$1(value: unknown, msg?: string): value is string;
|
|
80
|
+
declare function isEmptyString$1(value: unknown, msg?: string): value is "";
|
|
81
|
+
declare function isNonEmptyString$1(value: unknown, msg?: string): value is string;
|
|
82
|
+
declare function isStringOrUndefined$1(value: unknown, msg?: string): value is string | undefined;
|
|
83
|
+
declare function isEmptyStringOrUndefined$1(value: unknown, msg?: string): value is "" | undefined;
|
|
84
|
+
declare function isNonEmptyStringOrUndefined$1(value: unknown, msg?: string): value is string | undefined;
|
|
85
|
+
declare function isBoolean$1(value: unknown, msg?: string): value is boolean;
|
|
86
|
+
declare function isBooleanOrUndefined$1(value: unknown, msg?: string): value is boolean | undefined;
|
|
87
|
+
declare function isTrue$1(value: unknown, msg?: string): value is boolean;
|
|
88
|
+
declare function isTrueOrUndefined$1(value: unknown, msg?: string): value is boolean;
|
|
89
|
+
declare function isFalse$1(value: unknown, msg?: string): value is boolean;
|
|
90
|
+
declare function isFalseOrUndefined$1(value: unknown, msg?: string): value is boolean;
|
|
91
|
+
declare function isFunction$1(value: unknown, msg?: string): value is Function;
|
|
92
|
+
declare function isFunctionOrUndefined$1(value: unknown, msg?: string): value is Function | undefined;
|
|
93
|
+
declare function isEnumValue$1<E extends EnumObject>(enumValue: unknown, enumObject: E, msg?: string): enumValue is E[keyof E];
|
|
94
|
+
declare function isEnumValueOrUndefined$1<E extends EnumObject>(enumValue: unknown, enumObject: E, msg?: string): enumValue is E[keyof E];
|
|
95
|
+
declare function isNumber$1(value: unknown, msg?: string): value is number;
|
|
96
|
+
declare function isNumberOrUndefined$1(value: unknown, msg?: string): value is number | undefined;
|
|
97
|
+
declare function isFinite$1(value: unknown, msg?: string): value is number;
|
|
98
|
+
declare function isInteger$1(value: unknown, msg?: string): value is number;
|
|
99
|
+
declare function isIntegerOrUndefined$1(value: unknown, msg?: string): value is number | undefined;
|
|
100
|
+
declare function isIntegerEq$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
101
|
+
declare function isIntegerGt$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
102
|
+
declare function isIntegerGte$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
103
|
+
declare function isIntegerLt$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
104
|
+
declare function isIntegerLte$1(value: unknown, compareTo: unknown, msg?: string): value is number;
|
|
105
|
+
declare function isIntegerBetween$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
106
|
+
declare function isIntegerBetweenExclusive$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
107
|
+
declare function isNumberBetween$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
108
|
+
declare function isNumberBetweenExclusive$1(value: unknown, min: unknown, max: unknown, msg?: string): value is number;
|
|
109
|
+
declare function isNaNValue$1(value: unknown, msg?: string): value is number;
|
|
110
|
+
declare function isInfinity$1(value: unknown, msg?: string): value is number;
|
|
111
|
+
declare function isPosInfinity$1(value: unknown, msg?: string): value is number;
|
|
112
|
+
declare function isNegInfinity$1(value: unknown, msg?: string): value is number;
|
|
113
|
+
declare function isOddNumber$1(value: unknown, msg?: string): value is number;
|
|
114
|
+
declare function isEvenNumber$1(value: unknown, msg?: string): value is number;
|
|
115
|
+
declare function isIncluded$1<T>(value: T, array: ReadonlyArray<T>, msg?: string): value is T;
|
|
116
|
+
declare function isArrayIndex$1<T>(index: unknown, array: ReadonlyArray<T>, msg?: string): index is number;
|
|
117
|
+
declare function isThrowing$1(throwTestFn: () => void, msg?: string): true;
|
|
118
|
+
|
|
119
|
+
type index$7_ErrorConstructor = ErrorConstructor;
|
|
120
|
+
declare const index$7_array_elem: typeof array_elem;
|
|
121
|
+
declare const index$7_array_id: typeof array_id;
|
|
122
|
+
declare const index$7_assert: typeof assert;
|
|
123
|
+
declare const index$7_assertEnum: typeof assertEnum;
|
|
124
|
+
declare const index$7_eq: typeof eq;
|
|
125
|
+
declare const index$7_even: typeof even;
|
|
126
|
+
declare const index$7_fail: typeof fail;
|
|
127
|
+
declare const index$7_finite: typeof finite;
|
|
128
|
+
declare const index$7_in_group: typeof in_group;
|
|
129
|
+
declare const index$7_int: typeof int;
|
|
130
|
+
declare const index$7_int_between: typeof int_between;
|
|
131
|
+
declare const index$7_int_between_exclusive: typeof int_between_exclusive;
|
|
132
|
+
declare const index$7_int_eq: typeof int_eq;
|
|
133
|
+
declare const index$7_int_gt: typeof int_gt;
|
|
134
|
+
declare const index$7_int_gte: typeof int_gte;
|
|
135
|
+
declare const index$7_int_lt: typeof int_lt;
|
|
136
|
+
declare const index$7_int_lte: typeof int_lte;
|
|
137
|
+
declare const index$7_interrupt: typeof interrupt;
|
|
138
|
+
declare const index$7_odd: typeof odd;
|
|
139
|
+
declare const index$7_require: typeof require;
|
|
140
|
+
declare const index$7_requireDefined: typeof requireDefined;
|
|
141
|
+
declare const index$7_setErrorClass: typeof setErrorClass;
|
|
142
|
+
declare namespace index$7 {
|
|
143
|
+
export { type index$7_ErrorConstructor as ErrorConstructor, index$7_array_elem as array_elem, index$7_array_id as array_id, index$7_assert as assert, index$7_assertEnum as assertEnum, index$7_eq as eq, index$7_even as even, index$7_fail as fail, index$7_finite as finite, index$7_in_group as in_group, index$7_int as int, index$7_int_between as int_between, index$7_int_between_exclusive as int_between_exclusive, index$7_int_eq as int_eq, index$7_int_gt as int_gt, index$7_int_gte as int_gte, index$7_int_lt as int_lt, index$7_int_lte as int_lte, index$7_interrupt as interrupt, isArray$1 as isArray, isArrayIndex$1 as isArrayIndex, isArrayOrUndefined$1 as isArrayOrUndefined, isBoolean$1 as isBoolean, isBooleanOrUndefined$1 as isBooleanOrUndefined, isDeepEqual$1 as isDeepEqual, isEmptyArray$1 as isEmptyArray, isEmptyArrayOrUndefined$1 as isEmptyArrayOrUndefined, isEmptyString$1 as isEmptyString, isEmptyStringOrUndefined$1 as isEmptyStringOrUndefined, isEnumValue$1 as isEnumValue, isEnumValueOrUndefined$1 as isEnumValueOrUndefined, isEqual$1 as isEqual, isEvenNumber$1 as isEvenNumber, isFalse$1 as isFalse, isFalseOrUndefined$1 as isFalseOrUndefined, isFinite$1 as isFinite, isFunction$1 as isFunction, isFunctionOrUndefined$1 as isFunctionOrUndefined, isIncluded$1 as isIncluded, isInfinity$1 as isInfinity, isInteger$1 as isInteger, isIntegerBetween$1 as isIntegerBetween, isIntegerBetweenExclusive$1 as isIntegerBetweenExclusive, isIntegerEq$1 as isIntegerEq, isIntegerGt$1 as isIntegerGt, isIntegerGte$1 as isIntegerGte, isIntegerLt$1 as isIntegerLt, isIntegerLte$1 as isIntegerLte, isIntegerOrUndefined$1 as isIntegerOrUndefined, isNaNValue$1 as isNaNValue, isNegInfinity$1 as isNegInfinity, isNonEmptyArray$1 as isNonEmptyArray, isNonEmptyArrayOrUndefined$1 as isNonEmptyArrayOrUndefined, isNonEmptyString$1 as isNonEmptyString, isNonEmptyStringOrUndefined$1 as isNonEmptyStringOrUndefined, isNull$1 as isNull, isNullish$1 as isNullish, isNumber$1 as isNumber, isNumberBetween$1 as isNumberBetween, isNumberBetweenExclusive$1 as isNumberBetweenExclusive, isNumberOrUndefined$1 as isNumberOrUndefined, isObject$1 as isObject, isObjectOrUndefined$1 as isObjectOrUndefined, isOddNumber$1 as isOddNumber, isPosInfinity$1 as isPosInfinity, isString$1 as isString, isStringOrUndefined$1 as isStringOrUndefined, isThrowing$1 as isThrowing, isTrue$1 as isTrue, isTrueOrUndefined$1 as isTrueOrUndefined, isTypedObject$1 as isTypedObject, isUndefined$1 as isUndefined, index$7_odd as odd, index$7_require as require, index$7_requireDefined as requireDefined, index$7_setErrorClass as setErrorClass };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Set expiration time for cookies.
|
|
148
|
+
* @param days - Number of days until cookies expire.
|
|
149
|
+
*/
|
|
150
|
+
declare function setExpireDays(days: number): void;
|
|
151
|
+
/**
|
|
152
|
+
* Is consent pending (cookies not yet accepted)?
|
|
153
|
+
* @returns
|
|
154
|
+
*/
|
|
155
|
+
declare function isConsentPending(): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Consent cookies.
|
|
158
|
+
*/
|
|
159
|
+
declare function accept(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Decline cookies. This will reject all cookies than a single flags that cookies have been declined.
|
|
162
|
+
*/
|
|
163
|
+
declare function decline(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Save a cookie.
|
|
166
|
+
* @param name - Cookie name.
|
|
167
|
+
* @param value - Cookie value, can be string, number or boolean.
|
|
168
|
+
* @returns - Returns given value.
|
|
169
|
+
*/
|
|
170
|
+
declare function save<T extends string | number | boolean>(name: string, value: T): T;
|
|
171
|
+
/**
|
|
172
|
+
* Read a string cookie.
|
|
173
|
+
* @param name - Cookie name.
|
|
174
|
+
* @param defaultValue - Default value returned when cookie with given name was not found.
|
|
175
|
+
* @returns - String cookie value.
|
|
176
|
+
*/
|
|
177
|
+
declare function read(name: string, defaultValue: string): string;
|
|
178
|
+
/**
|
|
179
|
+
* Read an integer cookie.
|
|
180
|
+
* @param name - Cookie name.
|
|
181
|
+
* @param defaultValue - Default value returned when cookie with given name was not found.
|
|
182
|
+
* @returns - Integer cookie valus.
|
|
183
|
+
*/
|
|
184
|
+
declare function readInt(name: string, defaultValue: number): number;
|
|
185
|
+
/**
|
|
186
|
+
* Read a boolean cookie.
|
|
187
|
+
* @param name - Cookie name.
|
|
188
|
+
* @param defaultValue - Default value returned when cookie with given name was not found.
|
|
189
|
+
* @returns - Boolean cookie value.
|
|
190
|
+
*/
|
|
191
|
+
declare function readBool(name: string, defaultValue: boolean): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Erase cookie.
|
|
194
|
+
* @param name - Name of cookie to be erased.
|
|
195
|
+
*/
|
|
196
|
+
declare function erase(name: string): void;
|
|
197
|
+
/**
|
|
198
|
+
* Erase all cookies.
|
|
199
|
+
*/
|
|
200
|
+
declare function eraseAll(): void;
|
|
201
|
+
|
|
202
|
+
declare const cookies_accept: typeof accept;
|
|
203
|
+
declare const cookies_decline: typeof decline;
|
|
204
|
+
declare const cookies_erase: typeof erase;
|
|
205
|
+
declare const cookies_eraseAll: typeof eraseAll;
|
|
206
|
+
declare const cookies_isConsentPending: typeof isConsentPending;
|
|
207
|
+
declare const cookies_read: typeof read;
|
|
208
|
+
declare const cookies_readBool: typeof readBool;
|
|
209
|
+
declare const cookies_readInt: typeof readInt;
|
|
210
|
+
declare const cookies_save: typeof save;
|
|
211
|
+
declare const cookies_setExpireDays: typeof setExpireDays;
|
|
212
|
+
declare namespace cookies {
|
|
213
|
+
export { cookies_accept as accept, cookies_decline as decline, cookies_erase as erase, cookies_eraseAll as eraseAll, cookies_isConsentPending as isConsentPending, cookies_read as read, cookies_readBool as readBool, cookies_readInt as readInt, cookies_save as save, cookies_setExpireDays as setExpireDays };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Devices dots per inch. */
|
|
217
|
+
declare const DPI: number;
|
|
218
|
+
/** Devices pixels per millimeter. */
|
|
219
|
+
declare const PxPerMm: number;
|
|
220
|
+
/** Browsers scroll bar width. */
|
|
221
|
+
declare const ScrollbarWidth: number;
|
|
222
|
+
/** Browsers system font size. */
|
|
223
|
+
declare const FontSize: number;
|
|
224
|
+
/** Is touch device? */
|
|
225
|
+
declare const IsTouchDevice: boolean;
|
|
226
|
+
/** Is mobile device? */
|
|
227
|
+
declare const IsMobileDevice: boolean;
|
|
228
|
+
/** Host address. */
|
|
229
|
+
declare const HostAddress: string;
|
|
230
|
+
/**
|
|
231
|
+
* Convert pixels to millimeters on a device.
|
|
232
|
+
* @param px - Pixels.
|
|
233
|
+
* @returns - Millimeters.
|
|
234
|
+
*/
|
|
235
|
+
declare function pxToMm(px: number): number;
|
|
236
|
+
/**
|
|
237
|
+
* Convert millimeters to pixels on a device.
|
|
238
|
+
* @param mm - Millimeters.
|
|
239
|
+
* @returns - Pixels.
|
|
240
|
+
*/
|
|
241
|
+
declare function mmToPx(mm: number): number;
|
|
242
|
+
/**
|
|
243
|
+
* Convert input to pixels on a device. Input value is in html style form containing number
|
|
244
|
+
* followed by unit (e.g. "10px"). Supported units are "mm", "cm", "in", "inch", "em" and "px".
|
|
245
|
+
*
|
|
246
|
+
* @param input - Input value.
|
|
247
|
+
* @returns - Pixels.
|
|
248
|
+
*/
|
|
249
|
+
declare function toPx(input: string | number): number;
|
|
250
|
+
|
|
251
|
+
declare const device_DPI: typeof DPI;
|
|
252
|
+
declare const device_FontSize: typeof FontSize;
|
|
253
|
+
declare const device_HostAddress: typeof HostAddress;
|
|
254
|
+
declare const device_IsMobileDevice: typeof IsMobileDevice;
|
|
255
|
+
declare const device_IsTouchDevice: typeof IsTouchDevice;
|
|
256
|
+
declare const device_PxPerMm: typeof PxPerMm;
|
|
257
|
+
declare const device_ScrollbarWidth: typeof ScrollbarWidth;
|
|
258
|
+
declare const device_mmToPx: typeof mmToPx;
|
|
259
|
+
declare const device_pxToMm: typeof pxToMm;
|
|
260
|
+
declare const device_toPx: typeof toPx;
|
|
261
|
+
declare namespace device {
|
|
262
|
+
export { device_DPI as DPI, device_FontSize as FontSize, device_HostAddress as HostAddress, device_IsMobileDevice as IsMobileDevice, device_IsTouchDevice as IsTouchDevice, device_PxPerMm as PxPerMm, device_ScrollbarWidth as ScrollbarWidth, device_mmToPx as mmToPx, device_pxToMm as pxToMm, device_toPx as toPx };
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
declare function isEqual(value1: unknown, value2: unknown): boolean;
|
|
266
|
+
declare function isDeepEqual(value1: unknown, value2: unknown): boolean;
|
|
1
267
|
declare function isUndefined(value: unknown): value is undefined;
|
|
2
268
|
declare function isNull(value: unknown): value is null;
|
|
3
269
|
declare function isNullish(value: unknown): value is null | undefined;
|
|
4
270
|
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
5
271
|
declare function isObjectOrUndefined(value: unknown): value is Record<string, unknown> | undefined;
|
|
272
|
+
type HasProps<T extends object> = T extends Record<string, unknown> ? T : never;
|
|
273
|
+
declare function isTypedObject<T extends object>(obj: unknown, keys: (keyof T)[]): obj is HasProps<T>;
|
|
6
274
|
declare function isArray<T>(a: T[] | unknown): a is T[];
|
|
7
275
|
declare function isArrayOrUndefined(value: unknown): value is unknown[] | undefined;
|
|
8
276
|
declare function isEmptyArray<T>(a: T[] | unknown): a is T[];
|
|
@@ -17,6 +285,10 @@ declare function isEmptyStringOrUndefined(value: unknown): value is "" | undefin
|
|
|
17
285
|
declare function isNonEmptyStringOrUndefined(value: unknown): value is string | undefined;
|
|
18
286
|
declare function isBoolean(value: unknown): value is boolean;
|
|
19
287
|
declare function isBooleanOrUndefined(value: unknown): value is boolean | undefined;
|
|
288
|
+
declare function isTrue(value: unknown): value is true;
|
|
289
|
+
declare function isTrueOrUndefined(value: unknown): value is true;
|
|
290
|
+
declare function isFalse(value: unknown): value is false;
|
|
291
|
+
declare function isFalseOrUndefined(value: unknown): value is false;
|
|
20
292
|
declare function isFunction(value: unknown): value is Function;
|
|
21
293
|
declare function isFunctionOrUndefined(value: unknown): value is Function | undefined;
|
|
22
294
|
declare function isEnumValue<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): value is E[keyof E];
|
|
@@ -26,63 +298,90 @@ declare function isNumberOrUndefined(value: unknown): value is number | undefine
|
|
|
26
298
|
declare function isFinite(value: unknown): value is number;
|
|
27
299
|
declare function isInteger(n: unknown): n is number;
|
|
28
300
|
declare function isIntegerOrUndefined(n: unknown): n is number | undefined;
|
|
29
|
-
declare function isIntegerEq(value: unknown, compareTo:
|
|
30
|
-
declare function isIntegerGt(value: unknown, compareTo:
|
|
31
|
-
declare function isIntegerGte(value: unknown, compareTo:
|
|
32
|
-
declare function isIntegerLt(value: unknown, compareTo:
|
|
33
|
-
declare function isIntegerLte(value: unknown, compareTo:
|
|
34
|
-
declare function isIntegerBetween(value: unknown, min:
|
|
301
|
+
declare function isIntegerEq(value: unknown, compareTo: unknown): value is number;
|
|
302
|
+
declare function isIntegerGt(value: unknown, compareTo: unknown): value is number;
|
|
303
|
+
declare function isIntegerGte(value: unknown, compareTo: unknown): value is number;
|
|
304
|
+
declare function isIntegerLt(value: unknown, compareTo: unknown): value is number;
|
|
305
|
+
declare function isIntegerLte(value: unknown, compareTo: unknown): value is number;
|
|
306
|
+
declare function isIntegerBetween(value: unknown, min: unknown, max: unknown): value is number;
|
|
307
|
+
declare function isIntegerBetweenExclusive(value: unknown, min: unknown, max: unknown): value is number;
|
|
308
|
+
declare function isNumberBetween(value: unknown, min: unknown, max: unknown): value is number;
|
|
309
|
+
declare function isNumberBetweenExclusive(value: unknown, min: unknown, max: unknown): value is number;
|
|
35
310
|
declare function isNaNValue(value: unknown): value is number;
|
|
36
311
|
declare function isInfinity(value: unknown): value is number;
|
|
37
312
|
declare function isPosInfinity(value: unknown): value is number;
|
|
38
313
|
declare function isNegInfinity(value: unknown): value is number;
|
|
314
|
+
declare function isOddNumber(value: unknown): value is number;
|
|
315
|
+
declare function isEvenNumber(value: unknown): value is number;
|
|
316
|
+
declare function isIncluded<T>(value: T, array: ReadonlyArray<T>): value is T;
|
|
317
|
+
declare function isArrayIndex<T>(index: unknown, array: ReadonlyArray<T>): index is number;
|
|
318
|
+
declare function isThrowing(throwTestFn: () => void): boolean;
|
|
319
|
+
declare function tryOr<TRY_RVAL, OR_RVAL>(tryFn: () => TRY_RVAL, orVal: OR_RVAL | (() => OR_RVAL)): TRY_RVAL | OR_RVAL;
|
|
39
320
|
|
|
40
|
-
|
|
41
|
-
declare const
|
|
42
|
-
declare const
|
|
43
|
-
declare const
|
|
44
|
-
declare const
|
|
45
|
-
declare const
|
|
46
|
-
declare const
|
|
47
|
-
declare const
|
|
48
|
-
declare const
|
|
49
|
-
declare const
|
|
50
|
-
declare const
|
|
51
|
-
declare const
|
|
52
|
-
declare const
|
|
53
|
-
declare const
|
|
54
|
-
declare const
|
|
55
|
-
declare const
|
|
56
|
-
declare const
|
|
57
|
-
declare const
|
|
58
|
-
declare const
|
|
59
|
-
declare const
|
|
60
|
-
declare const
|
|
61
|
-
declare const
|
|
62
|
-
declare const
|
|
63
|
-
declare const
|
|
64
|
-
declare const
|
|
65
|
-
declare const
|
|
66
|
-
declare const
|
|
67
|
-
declare const
|
|
68
|
-
declare const
|
|
69
|
-
declare const
|
|
70
|
-
declare const
|
|
71
|
-
declare const
|
|
72
|
-
declare const
|
|
73
|
-
declare const
|
|
74
|
-
declare const
|
|
75
|
-
declare const
|
|
76
|
-
declare const
|
|
77
|
-
declare const
|
|
78
|
-
declare
|
|
79
|
-
|
|
321
|
+
type Guard_HasProps<T extends object> = HasProps<T>;
|
|
322
|
+
declare const Guard_isArray: typeof isArray;
|
|
323
|
+
declare const Guard_isArrayIndex: typeof isArrayIndex;
|
|
324
|
+
declare const Guard_isArrayOrUndefined: typeof isArrayOrUndefined;
|
|
325
|
+
declare const Guard_isBoolean: typeof isBoolean;
|
|
326
|
+
declare const Guard_isBooleanOrUndefined: typeof isBooleanOrUndefined;
|
|
327
|
+
declare const Guard_isDeepEqual: typeof isDeepEqual;
|
|
328
|
+
declare const Guard_isEmptyArray: typeof isEmptyArray;
|
|
329
|
+
declare const Guard_isEmptyArrayOrUndefined: typeof isEmptyArrayOrUndefined;
|
|
330
|
+
declare const Guard_isEmptyString: typeof isEmptyString;
|
|
331
|
+
declare const Guard_isEmptyStringOrUndefined: typeof isEmptyStringOrUndefined;
|
|
332
|
+
declare const Guard_isEnumValue: typeof isEnumValue;
|
|
333
|
+
declare const Guard_isEnumValueOrUndefined: typeof isEnumValueOrUndefined;
|
|
334
|
+
declare const Guard_isEqual: typeof isEqual;
|
|
335
|
+
declare const Guard_isEvenNumber: typeof isEvenNumber;
|
|
336
|
+
declare const Guard_isFalse: typeof isFalse;
|
|
337
|
+
declare const Guard_isFalseOrUndefined: typeof isFalseOrUndefined;
|
|
338
|
+
declare const Guard_isFinite: typeof isFinite;
|
|
339
|
+
declare const Guard_isFunction: typeof isFunction;
|
|
340
|
+
declare const Guard_isFunctionOrUndefined: typeof isFunctionOrUndefined;
|
|
341
|
+
declare const Guard_isIncluded: typeof isIncluded;
|
|
342
|
+
declare const Guard_isInfinity: typeof isInfinity;
|
|
343
|
+
declare const Guard_isInteger: typeof isInteger;
|
|
344
|
+
declare const Guard_isIntegerBetween: typeof isIntegerBetween;
|
|
345
|
+
declare const Guard_isIntegerBetweenExclusive: typeof isIntegerBetweenExclusive;
|
|
346
|
+
declare const Guard_isIntegerEq: typeof isIntegerEq;
|
|
347
|
+
declare const Guard_isIntegerGt: typeof isIntegerGt;
|
|
348
|
+
declare const Guard_isIntegerGte: typeof isIntegerGte;
|
|
349
|
+
declare const Guard_isIntegerLt: typeof isIntegerLt;
|
|
350
|
+
declare const Guard_isIntegerLte: typeof isIntegerLte;
|
|
351
|
+
declare const Guard_isIntegerOrUndefined: typeof isIntegerOrUndefined;
|
|
352
|
+
declare const Guard_isNaNValue: typeof isNaNValue;
|
|
353
|
+
declare const Guard_isNegInfinity: typeof isNegInfinity;
|
|
354
|
+
declare const Guard_isNonEmptyArray: typeof isNonEmptyArray;
|
|
355
|
+
declare const Guard_isNonEmptyArrayOrUndefined: typeof isNonEmptyArrayOrUndefined;
|
|
356
|
+
declare const Guard_isNonEmptyString: typeof isNonEmptyString;
|
|
357
|
+
declare const Guard_isNonEmptyStringOrUndefined: typeof isNonEmptyStringOrUndefined;
|
|
358
|
+
declare const Guard_isNull: typeof isNull;
|
|
359
|
+
declare const Guard_isNullish: typeof isNullish;
|
|
360
|
+
declare const Guard_isNumber: typeof isNumber;
|
|
361
|
+
declare const Guard_isNumberBetween: typeof isNumberBetween;
|
|
362
|
+
declare const Guard_isNumberBetweenExclusive: typeof isNumberBetweenExclusive;
|
|
363
|
+
declare const Guard_isNumberOrUndefined: typeof isNumberOrUndefined;
|
|
364
|
+
declare const Guard_isObject: typeof isObject;
|
|
365
|
+
declare const Guard_isObjectOrUndefined: typeof isObjectOrUndefined;
|
|
366
|
+
declare const Guard_isOddNumber: typeof isOddNumber;
|
|
367
|
+
declare const Guard_isPosInfinity: typeof isPosInfinity;
|
|
368
|
+
declare const Guard_isString: typeof isString;
|
|
369
|
+
declare const Guard_isStringOrUndefined: typeof isStringOrUndefined;
|
|
370
|
+
declare const Guard_isThrowing: typeof isThrowing;
|
|
371
|
+
declare const Guard_isTrue: typeof isTrue;
|
|
372
|
+
declare const Guard_isTrueOrUndefined: typeof isTrueOrUndefined;
|
|
373
|
+
declare const Guard_isTypedObject: typeof isTypedObject;
|
|
374
|
+
declare const Guard_isUndefined: typeof isUndefined;
|
|
375
|
+
declare const Guard_tryOr: typeof tryOr;
|
|
376
|
+
declare namespace Guard {
|
|
377
|
+
export { type Guard_HasProps as HasProps, Guard_isArray as isArray, Guard_isArrayIndex as isArrayIndex, Guard_isArrayOrUndefined as isArrayOrUndefined, Guard_isBoolean as isBoolean, Guard_isBooleanOrUndefined as isBooleanOrUndefined, Guard_isDeepEqual as isDeepEqual, Guard_isEmptyArray as isEmptyArray, Guard_isEmptyArrayOrUndefined as isEmptyArrayOrUndefined, Guard_isEmptyString as isEmptyString, Guard_isEmptyStringOrUndefined as isEmptyStringOrUndefined, Guard_isEnumValue as isEnumValue, Guard_isEnumValueOrUndefined as isEnumValueOrUndefined, Guard_isEqual as isEqual, Guard_isEvenNumber as isEvenNumber, Guard_isFalse as isFalse, Guard_isFalseOrUndefined as isFalseOrUndefined, Guard_isFinite as isFinite, Guard_isFunction as isFunction, Guard_isFunctionOrUndefined as isFunctionOrUndefined, Guard_isIncluded as isIncluded, Guard_isInfinity as isInfinity, Guard_isInteger as isInteger, Guard_isIntegerBetween as isIntegerBetween, Guard_isIntegerBetweenExclusive as isIntegerBetweenExclusive, Guard_isIntegerEq as isIntegerEq, Guard_isIntegerGt as isIntegerGt, Guard_isIntegerGte as isIntegerGte, Guard_isIntegerLt as isIntegerLt, Guard_isIntegerLte as isIntegerLte, Guard_isIntegerOrUndefined as isIntegerOrUndefined, Guard_isNaNValue as isNaNValue, Guard_isNegInfinity as isNegInfinity, Guard_isNonEmptyArray as isNonEmptyArray, Guard_isNonEmptyArrayOrUndefined as isNonEmptyArrayOrUndefined, Guard_isNonEmptyString as isNonEmptyString, Guard_isNonEmptyStringOrUndefined as isNonEmptyStringOrUndefined, Guard_isNull as isNull, Guard_isNullish as isNullish, Guard_isNumber as isNumber, Guard_isNumberBetween as isNumberBetween, Guard_isNumberBetweenExclusive as isNumberBetweenExclusive, Guard_isNumberOrUndefined as isNumberOrUndefined, Guard_isObject as isObject, Guard_isObjectOrUndefined as isObjectOrUndefined, Guard_isOddNumber as isOddNumber, Guard_isPosInfinity as isPosInfinity, Guard_isString as isString, Guard_isStringOrUndefined as isStringOrUndefined, Guard_isThrowing as isThrowing, Guard_isTrue as isTrue, Guard_isTrueOrUndefined as isTrueOrUndefined, Guard_isTypedObject as isTypedObject, Guard_isUndefined as isUndefined, Guard_tryOr as tryOr };
|
|
80
378
|
}
|
|
81
379
|
|
|
82
380
|
declare function toArray<T>(a: T | T[]): Array<T>;
|
|
83
381
|
declare function duplicate<T>(a: T[] | undefined): T[] | undefined;
|
|
84
|
-
declare function removeDuplicates<T>(
|
|
85
|
-
|
|
382
|
+
declare function removeDuplicates<T>(arr: T[], compareFn?: (a: T, b: T) => boolean): T[];
|
|
383
|
+
/** @deprecated - Use {@link removeDuplicates} with compareFn instead. */
|
|
384
|
+
declare function removeDuplicatesCmp<T>(arr: ReadonlyArray<T>, compareFn: (t1: T, t2: T) => boolean): T[];
|
|
86
385
|
declare function fillArray<T>(fillValue: T, fillCount: number): T[];
|
|
87
386
|
declare function mapSequenceArray<T>(len: number, fn: (i: number) => T): T[];
|
|
88
387
|
declare function getSequenceArray(len: number): number[];
|
|
@@ -91,20 +390,20 @@ declare function getRangeArray(start: number, end: number): number[];
|
|
|
91
390
|
declare function arrayContains<T extends unknown>(arg: T[], item: T): boolean;
|
|
92
391
|
declare function chunckArray<A>(arr: ReadonlyArray<A>, chunckSize: number): A[][];
|
|
93
392
|
|
|
94
|
-
declare const index$
|
|
95
|
-
declare const index$
|
|
96
|
-
declare const index$
|
|
97
|
-
declare const index$
|
|
98
|
-
declare const index$
|
|
99
|
-
declare const index$
|
|
100
|
-
declare const index$
|
|
101
|
-
declare const index$
|
|
102
|
-
declare const index$
|
|
103
|
-
declare const index$
|
|
104
|
-
declare const index$
|
|
105
|
-
declare const index$
|
|
106
|
-
declare namespace index$
|
|
107
|
-
export { index$
|
|
393
|
+
declare const index$6_arrayContains: typeof arrayContains;
|
|
394
|
+
declare const index$6_chunckArray: typeof chunckArray;
|
|
395
|
+
declare const index$6_duplicate: typeof duplicate;
|
|
396
|
+
declare const index$6_fillArray: typeof fillArray;
|
|
397
|
+
declare const index$6_getRangeArray: typeof getRangeArray;
|
|
398
|
+
declare const index$6_getSequenceArray: typeof getSequenceArray;
|
|
399
|
+
declare const index$6_isArray: typeof isArray;
|
|
400
|
+
declare const index$6_mapRangeArray: typeof mapRangeArray;
|
|
401
|
+
declare const index$6_mapSequenceArray: typeof mapSequenceArray;
|
|
402
|
+
declare const index$6_removeDuplicates: typeof removeDuplicates;
|
|
403
|
+
declare const index$6_removeDuplicatesCmp: typeof removeDuplicatesCmp;
|
|
404
|
+
declare const index$6_toArray: typeof toArray;
|
|
405
|
+
declare namespace index$6 {
|
|
406
|
+
export { index$6_arrayContains as arrayContains, index$6_chunckArray as chunckArray, index$6_duplicate as duplicate, index$6_fillArray as fillArray, index$6_getRangeArray as getRangeArray, index$6_getSequenceArray as getSequenceArray, index$6_isArray as isArray, index$6_mapRangeArray as mapRangeArray, index$6_mapSequenceArray as mapSequenceArray, index$6_removeDuplicates as removeDuplicates, index$6_removeDuplicatesCmp as removeDuplicatesCmp, index$6_toArray as toArray };
|
|
108
407
|
}
|
|
109
408
|
|
|
110
409
|
interface CSSProperties {
|
|
@@ -153,43 +452,28 @@ declare function getDimension(style?: CSSProperties): {
|
|
|
153
452
|
declare function styleLayoutChanged(style1?: CSSProperties, style2?: CSSProperties): boolean;
|
|
154
453
|
declare function getCanvasTextWidth(text: string, font: string): number;
|
|
155
454
|
|
|
156
|
-
type index$
|
|
157
|
-
declare const index$
|
|
158
|
-
declare const index$
|
|
159
|
-
declare const index$
|
|
160
|
-
declare const index$
|
|
161
|
-
declare const index$
|
|
162
|
-
declare const index$
|
|
163
|
-
declare const index$
|
|
164
|
-
declare const index$
|
|
165
|
-
declare const index$
|
|
166
|
-
declare const index$
|
|
167
|
-
declare const index$
|
|
168
|
-
declare const index$
|
|
169
|
-
declare const index$
|
|
170
|
-
declare const index$
|
|
171
|
-
declare const index$
|
|
172
|
-
declare const index$
|
|
173
|
-
declare const index$
|
|
174
|
-
declare const index$
|
|
175
|
-
declare const index$
|
|
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 };
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
type EnumObject = {
|
|
181
|
-
[key: string]: string | number;
|
|
182
|
-
};
|
|
183
|
-
type EnumValue<E extends EnumObject> = E extends {
|
|
184
|
-
[key: string]: string | infer V;
|
|
185
|
-
} ? V : never;
|
|
186
|
-
declare function getEnumValues<E extends EnumObject>(e: E): Array<EnumValue<E>>;
|
|
187
|
-
|
|
188
|
-
type index$5_EnumObject = EnumObject;
|
|
189
|
-
type index$5_EnumValue<E extends EnumObject> = EnumValue<E>;
|
|
190
|
-
declare const index$5_getEnumValues: typeof getEnumValues;
|
|
455
|
+
type index$5_CSSProperties = CSSProperties;
|
|
456
|
+
declare const index$5_addClass: typeof addClass;
|
|
457
|
+
declare const index$5_appendTo: typeof appendTo;
|
|
458
|
+
declare const index$5_getButton: typeof getButton;
|
|
459
|
+
declare const index$5_getCanvas: typeof getCanvas;
|
|
460
|
+
declare const index$5_getCanvasTextWidth: typeof getCanvasTextWidth;
|
|
461
|
+
declare const index$5_getDimension: typeof getDimension;
|
|
462
|
+
declare const index$5_getHeight: typeof getHeight;
|
|
463
|
+
declare const index$5_getOffset: typeof getOffset;
|
|
464
|
+
declare const index$5_getPadding: typeof getPadding;
|
|
465
|
+
declare const index$5_getWidth: typeof getWidth;
|
|
466
|
+
declare const index$5_hasClass: typeof hasClass;
|
|
467
|
+
declare const index$5_removeClass: typeof removeClass;
|
|
468
|
+
declare const index$5_removeFromParent: typeof removeFromParent;
|
|
469
|
+
declare const index$5_setHeight: typeof setHeight;
|
|
470
|
+
declare const index$5_setOffset: typeof setOffset;
|
|
471
|
+
declare const index$5_setRect: typeof setRect;
|
|
472
|
+
declare const index$5_setVisibility: typeof setVisibility;
|
|
473
|
+
declare const index$5_setWidth: typeof setWidth;
|
|
474
|
+
declare const index$5_styleLayoutChanged: typeof styleLayoutChanged;
|
|
191
475
|
declare namespace index$5 {
|
|
192
|
-
export { type index$
|
|
476
|
+
export { type index$5_CSSProperties as CSSProperties, index$5_addClass as addClass, index$5_appendTo as appendTo, index$5_getButton as getButton, index$5_getCanvas as getCanvas, index$5_getCanvasTextWidth as getCanvasTextWidth, index$5_getDimension as getDimension, index$5_getHeight as getHeight, index$5_getOffset as getOffset, index$5_getPadding as getPadding, index$5_getWidth as getWidth, index$5_hasClass as hasClass, index$5_removeClass as removeClass, index$5_removeFromParent as removeFromParent, index$5_setHeight as setHeight, index$5_setOffset as setOffset, index$5_setRect as setRect, index$5_setVisibility as setVisibility, index$5_setWidth as setWidth, index$5_styleLayoutChanged as styleLayoutChanged };
|
|
193
477
|
}
|
|
194
478
|
|
|
195
479
|
declare function getMapKeys<K, V>(map: Map<K, V>): K[];
|
|
@@ -321,71 +605,43 @@ declare namespace index$1 {
|
|
|
321
605
|
export { index$1_charCount as charCount, index$1_chunkString as chunkString, index$1_insertAt as insertAt, index$1_isString as isString, index$1_makeSentenceFromPascal as makeSentenceFromPascal, index$1_removeAt as removeAt, index$1_repeatString as repeatString, index$1_replaceAt as replaceAt, index$1_toCharArray as toCharArray };
|
|
322
606
|
}
|
|
323
607
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
declare namespace Assert {
|
|
329
|
-
type ErrorConstructor = new (msg: string) => Error;
|
|
330
|
-
function setErrorClass(ec?: ErrorConstructor): void;
|
|
331
|
-
function assert<T>(a: T, userMsg?: string): void;
|
|
332
|
-
function assertEnum<E extends Record<string, string | number>>(value: unknown, enumObj: E, name?: string): asserts value is E[keyof E];
|
|
333
|
-
function interrupt(userMsg?: string): never;
|
|
334
|
-
function int(a: unknown, userMsg?: string): number;
|
|
335
|
-
function eq<T>(a: T, b: T, userMsg?: string): T;
|
|
336
|
-
function int_eq(a: unknown, b: unknown, userMsg?: string): number;
|
|
337
|
-
function int_lt(a: unknown, b: unknown, userMsg?: string): number;
|
|
338
|
-
function int_lte(a: unknown, b: unknown, userMsg?: string): number;
|
|
339
|
-
function int_gt(a: unknown, b: unknown, userMsg?: string): number;
|
|
340
|
-
function int_gte(a: unknown, b: unknown, userMsg?: string): number;
|
|
341
|
-
function int_between(a: unknown, min: unknown, max: unknown, userMsg?: string): number;
|
|
342
|
-
function odd(a: unknown, userMsg?: string): number;
|
|
343
|
-
function even(a: unknown, userMsg?: string): number;
|
|
344
|
-
function in_group<T>(a: T, group: ReadonlyArray<T>, userMsg?: string): T;
|
|
345
|
-
function finite(a: unknown, userMsg?: string): number;
|
|
346
|
-
function array_id<T>(arr: Readonly<T[]>, id: unknown, userMsg?: string): number;
|
|
347
|
-
function array_elem<T>(arr: Readonly<T[]>, id: number, userMsg?: string): T;
|
|
348
|
-
function require<T>(arg: T, userMsg?: string): NonNullable<T>;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
declare namespace Cookies {
|
|
352
|
-
function setExpireDays(days: number): void;
|
|
353
|
-
function isConsentPending(): boolean;
|
|
354
|
-
function accept(): void;
|
|
355
|
-
function decline(): void;
|
|
356
|
-
function save<T extends string | number | boolean>(name: string, value: T): T;
|
|
357
|
-
function read(name: string, defaultValue: string): string;
|
|
358
|
-
function readInt(name: string, defaultValue: number): number;
|
|
359
|
-
function readBool(name: string, defaultValue: boolean): boolean;
|
|
360
|
-
function erase(name: string): void;
|
|
361
|
-
function eraseAll(): void;
|
|
362
|
-
}
|
|
608
|
+
/**
|
|
609
|
+
* @deprecated Use {@link Guard} instead.
|
|
610
|
+
*/
|
|
611
|
+
declare const Is: typeof Guard;
|
|
363
612
|
|
|
364
|
-
declare
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const ScrollbarWidth: number;
|
|
368
|
-
const FontSize: number;
|
|
369
|
-
const IsTouchDevice: boolean;
|
|
370
|
-
const IsMobileDevice: boolean;
|
|
371
|
-
const HostAddress: string;
|
|
372
|
-
function pxToMm(px: number): number;
|
|
373
|
-
function mmToPx(mm: number): number;
|
|
374
|
-
function toPx(input: string | number): number;
|
|
613
|
+
declare const index_Is: typeof Is;
|
|
614
|
+
declare namespace index {
|
|
615
|
+
export { index$6 as Arr, index$5 as Dom, index$8 as Enum, index_Is as Is, index$4 as Map, index$3 as Math, index$2 as Obj, index$1 as Str };
|
|
375
616
|
}
|
|
376
617
|
|
|
618
|
+
/**
|
|
619
|
+
* This is a stack data structure.
|
|
620
|
+
*/
|
|
377
621
|
declare class Stack<T> {
|
|
378
|
-
private readonly
|
|
379
|
-
|
|
622
|
+
private readonly data;
|
|
623
|
+
private assertId;
|
|
624
|
+
get length(): number;
|
|
625
|
+
push(el: T): T;
|
|
380
626
|
pop(): T;
|
|
627
|
+
popOrUndef(): T | undefined;
|
|
628
|
+
popOr(defaultValueOrCreator: T | (() => T)): T;
|
|
381
629
|
top(): T;
|
|
630
|
+
topOrUndef(): T | undefined;
|
|
631
|
+
topOr(defaultValueOrCreator: T | (() => T)): T;
|
|
632
|
+
peek(depth?: number): T;
|
|
633
|
+
peekOrUndef(depth?: number): T | undefined;
|
|
634
|
+
peekOr(depth: number | undefined, defaultValueOrCreator: T | (() => T)): T;
|
|
635
|
+
values(): IterableIterator<T>;
|
|
636
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
382
637
|
toArray(): T[];
|
|
383
|
-
|
|
638
|
+
isEmpty(): boolean;
|
|
384
639
|
clear(): void;
|
|
640
|
+
toString(): string;
|
|
385
641
|
}
|
|
386
642
|
|
|
387
643
|
/**
|
|
388
|
-
*
|
|
644
|
+
* `Vec` is a generic vector class with two or more coordinates.
|
|
389
645
|
*
|
|
390
646
|
* ```ts
|
|
391
647
|
* // Example usage:
|
|
@@ -405,7 +661,9 @@ declare class Vec {
|
|
|
405
661
|
static vec2(x: number, y: number): Vec;
|
|
406
662
|
static vec3(x: number, y: number, z: number): Vec;
|
|
407
663
|
static zero(dim: number): Vec;
|
|
664
|
+
get dim(): number;
|
|
408
665
|
get length(): number;
|
|
666
|
+
magnitude(): number;
|
|
409
667
|
get x(): number;
|
|
410
668
|
get y(): number;
|
|
411
669
|
get z(): number;
|
|
@@ -418,6 +676,9 @@ declare class Vec {
|
|
|
418
676
|
dot(other: Vec): number;
|
|
419
677
|
distance(other: Vec): number;
|
|
420
678
|
normalize(): Vec;
|
|
679
|
+
static lerp(a: Vec, b: Vec, t: number): Vec;
|
|
680
|
+
toLength(len: number): Vec;
|
|
681
|
+
clamp(minLength?: number, maxLength?: number, defaultDir?: Vec): Vec;
|
|
421
682
|
equals(other: Vec): boolean;
|
|
422
683
|
clone(): Vec;
|
|
423
684
|
toObject(): {
|
|
@@ -430,14 +691,14 @@ declare class Vec {
|
|
|
430
691
|
}
|
|
431
692
|
|
|
432
693
|
/**
|
|
433
|
-
* DivRect class
|
|
694
|
+
* DivRect class is a rectangle (left, top, right, bottom) with an anchor point (anchorX, anchorY).
|
|
434
695
|
*/
|
|
435
696
|
declare class DivRect {
|
|
436
697
|
left: number;
|
|
437
|
-
|
|
698
|
+
anchorX: number;
|
|
438
699
|
right: number;
|
|
439
700
|
top: number;
|
|
440
|
-
|
|
701
|
+
anchorY: number;
|
|
441
702
|
bottom: number;
|
|
442
703
|
/**
|
|
443
704
|
* Create rectangle with all zero values.
|
|
@@ -445,7 +706,7 @@ declare class DivRect {
|
|
|
445
706
|
constructor();
|
|
446
707
|
/**
|
|
447
708
|
* Create rectangle with left, right, top, bottom.
|
|
448
|
-
* Properties
|
|
709
|
+
* Properties anchorX and anchorY will be centered in the middle.
|
|
449
710
|
*
|
|
450
711
|
* @param left - Left coordinate.
|
|
451
712
|
* @param right - Right coordinate.
|
|
@@ -457,13 +718,13 @@ declare class DivRect {
|
|
|
457
718
|
* Create rectangle with full arguments.
|
|
458
719
|
*
|
|
459
720
|
* @param left - Left coordinate.
|
|
460
|
-
* @param
|
|
721
|
+
* @param anchorX - Center x-coordinate.
|
|
461
722
|
* @param right - Right coordinate.
|
|
462
723
|
* @param top - Top coordinate.
|
|
463
|
-
* @param
|
|
724
|
+
* @param anchorY - Center y-coordinate.
|
|
464
725
|
* @param bottom - Bottom coordinate.
|
|
465
726
|
*/
|
|
466
|
-
constructor(left: number,
|
|
727
|
+
constructor(left: number, anchorX: number, right: number, top: number, anchorY: number, bottom: number);
|
|
467
728
|
/**
|
|
468
729
|
* Create rect from basic left, top, width and height arguments.
|
|
469
730
|
*
|
|
@@ -475,7 +736,7 @@ declare class DivRect {
|
|
|
475
736
|
*/
|
|
476
737
|
static create(left: number, top: number, width: number, height: number): DivRect;
|
|
477
738
|
/**
|
|
478
|
-
* Create rect from
|
|
739
|
+
* Create rect from anchorX, anchorY, width, height arguments.
|
|
479
740
|
*
|
|
480
741
|
* @param centerX - Center x-coordinate.
|
|
481
742
|
* @param centerY - Center y-coordinate.
|
|
@@ -494,6 +755,14 @@ declare class DivRect {
|
|
|
494
755
|
* @returns - DivRect.
|
|
495
756
|
*/
|
|
496
757
|
static createSections(leftw: number, rightw: number, toph: number, bottomh: number): DivRect;
|
|
758
|
+
/** @deprecated - Renamed to anchorX. */
|
|
759
|
+
get centerX(): number;
|
|
760
|
+
/** @deprecated - Renamed to anchorX. */
|
|
761
|
+
set centerX(x: number);
|
|
762
|
+
/** @deprecated - Renamed to anchorY. */
|
|
763
|
+
get centerY(): number;
|
|
764
|
+
/** @deprecated - Renamed to anchorY. */
|
|
765
|
+
set centerY(y: number);
|
|
497
766
|
/**
|
|
498
767
|
* Width getter.
|
|
499
768
|
*/
|
|
@@ -556,7 +825,7 @@ declare class DivRect {
|
|
|
556
825
|
*/
|
|
557
826
|
equals(other: DivRect): boolean;
|
|
558
827
|
/**
|
|
559
|
-
* Check if edges of given rects are equal, ignoring
|
|
828
|
+
* Check if edges of given rects are equal, ignoring anchorX and anchorY.
|
|
560
829
|
*
|
|
561
830
|
* @param a - DivRect a.
|
|
562
831
|
* @param b - DivRect b.
|
|
@@ -564,12 +833,14 @@ declare class DivRect {
|
|
|
564
833
|
*/
|
|
565
834
|
static equalsEdges(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
566
835
|
/**
|
|
567
|
-
* Check if edges of this Rect equals with given Rect, ignoring
|
|
836
|
+
* Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
|
|
568
837
|
*
|
|
569
838
|
* @param other - The other DivRect.
|
|
570
839
|
* @returns - True/false.
|
|
571
840
|
*/
|
|
572
841
|
equalsEdges(other: DivRect): boolean;
|
|
842
|
+
/** @deprecated - Use `DivRect.equalsEdges()` instead. */
|
|
843
|
+
static equalsFrame(a: DivRect | null | undefined, b: DivRect | null | undefined): boolean;
|
|
573
844
|
/**
|
|
574
845
|
* Created duplicate of this Rect.
|
|
575
846
|
*
|
|
@@ -621,7 +892,7 @@ declare class DivRect {
|
|
|
621
892
|
*/
|
|
622
893
|
clipCopy(clipRect: DivRect): DivRect;
|
|
623
894
|
/**
|
|
624
|
-
* Scale Rect. Anchor pos is (
|
|
895
|
+
* Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
|
|
625
896
|
*
|
|
626
897
|
* @param scaleX - Scale x-amount.
|
|
627
898
|
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
@@ -629,7 +900,7 @@ declare class DivRect {
|
|
|
629
900
|
*/
|
|
630
901
|
scaleInPlace(scaleX: number, scaleY?: number): DivRect;
|
|
631
902
|
/**
|
|
632
|
-
* Scale Rect. Anchor pos is (
|
|
903
|
+
* Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
|
|
633
904
|
*
|
|
634
905
|
* @param scaleX - Scale x-amount.
|
|
635
906
|
* @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
|
|
@@ -644,7 +915,7 @@ declare class DivRect {
|
|
|
644
915
|
}
|
|
645
916
|
|
|
646
917
|
/**
|
|
647
|
-
* LRUCache
|
|
918
|
+
* LRUCache is an implementation of least recently used cache with a fixed capacity.
|
|
648
919
|
*/
|
|
649
920
|
declare class LRUCache<K extends string, V> {
|
|
650
921
|
private cache;
|
|
@@ -681,7 +952,8 @@ interface KVComponent<K extends any[], VALUE> {
|
|
|
681
952
|
}
|
|
682
953
|
|
|
683
954
|
/**
|
|
684
|
-
*
|
|
955
|
+
* `IndexArray` is a sparse array with non-negative indexes. It stores values
|
|
956
|
+
* to indexes, and each index also has flag telling it has a value.
|
|
685
957
|
*/
|
|
686
958
|
declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
687
959
|
private static validateIndex;
|
|
@@ -693,6 +965,8 @@ declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
693
965
|
constructor(entries: Iterable<[number, VALUE]>);
|
|
694
966
|
private get posLen();
|
|
695
967
|
get size(): number;
|
|
968
|
+
get length(): number;
|
|
969
|
+
private trimRight;
|
|
696
970
|
isEmpty(): boolean;
|
|
697
971
|
has(id: number): boolean;
|
|
698
972
|
set(id: number, value: VALUE): void;
|
|
@@ -712,7 +986,7 @@ declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
712
986
|
kvKeys(): IterableIterator<[number]>;
|
|
713
987
|
kvValues(): IterableIterator<VALUE>;
|
|
714
988
|
kvEntries(): IterableIterator<[[number], VALUE]>;
|
|
715
|
-
[Symbol.iterator]():
|
|
989
|
+
[Symbol.iterator](): IterableIterator<[number, VALUE]>;
|
|
716
990
|
clone(): IndexArray<VALUE>;
|
|
717
991
|
merge(other: IndexArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
|
|
718
992
|
some(fn: (value: VALUE, id: number) => boolean): boolean;
|
|
@@ -725,11 +999,13 @@ declare class IndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
725
999
|
map<R = VALUE>(fn: (value: VALUE, key1: number) => R): IndexArray<R>;
|
|
726
1000
|
equals(other: IndexArray<VALUE>): boolean;
|
|
727
1001
|
equals(other: IndexArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
|
|
1002
|
+
toArray(): VALUE[];
|
|
728
1003
|
toString(): string;
|
|
729
1004
|
}
|
|
730
1005
|
|
|
731
1006
|
/**
|
|
732
|
-
*
|
|
1007
|
+
* `IndexArray` is a sparse array with positive and negative indexes. It stores
|
|
1008
|
+
* values to indexes, and each index also has flag telling it has a value.
|
|
733
1009
|
*/
|
|
734
1010
|
declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
735
1011
|
private static toNegIndex;
|
|
@@ -764,7 +1040,7 @@ declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
764
1040
|
kvKeys(): IterableIterator<[number]>;
|
|
765
1041
|
kvValues(): IterableIterator<VALUE>;
|
|
766
1042
|
kvEntries(): IterableIterator<[[number], VALUE]>;
|
|
767
|
-
[Symbol.iterator]():
|
|
1043
|
+
[Symbol.iterator](): IterableIterator<[number, VALUE]>;
|
|
768
1044
|
clone(): SignedIndexArray<VALUE>;
|
|
769
1045
|
merge(other: SignedIndexArray<VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, id: number) => VALUE): this;
|
|
770
1046
|
some(fn: (value: VALUE, id: number) => boolean): boolean;
|
|
@@ -777,9 +1053,13 @@ declare class SignedIndexArray<VALUE> implements KVComponent<[number], VALUE> {
|
|
|
777
1053
|
map<R = VALUE>(fn: (value: VALUE, key1: number) => R): SignedIndexArray<R>;
|
|
778
1054
|
equals(other: SignedIndexArray<VALUE>): boolean;
|
|
779
1055
|
equals(other: SignedIndexArray<VALUE>, eq: (a: VALUE, b: VALUE) => boolean): boolean;
|
|
1056
|
+
toArray(): VALUE[];
|
|
780
1057
|
toString(): string;
|
|
781
1058
|
}
|
|
782
1059
|
|
|
1060
|
+
/**
|
|
1061
|
+
* A Map implementation mapping a single key to a value.
|
|
1062
|
+
*/
|
|
783
1063
|
declare class Map1<KEY1, VALUE> implements KVComponent<[KEY1], VALUE> {
|
|
784
1064
|
private map1;
|
|
785
1065
|
constructor();
|
|
@@ -805,7 +1085,7 @@ declare class Map1<KEY1, VALUE> implements KVComponent<[KEY1], VALUE> {
|
|
|
805
1085
|
kvKeys(): IterableIterator<[KEY1]>;
|
|
806
1086
|
kvValues(): IterableIterator<VALUE>;
|
|
807
1087
|
kvEntries(): IterableIterator<[[KEY1], VALUE]>;
|
|
808
|
-
[Symbol.iterator]():
|
|
1088
|
+
[Symbol.iterator](): IterableIterator<[KEY1, VALUE]>;
|
|
809
1089
|
clone(): Map1<KEY1, VALUE>;
|
|
810
1090
|
merge(other: Map1<KEY1, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1) => VALUE): this;
|
|
811
1091
|
some(fn: (value: VALUE, key1: KEY1) => boolean): boolean;
|
|
@@ -820,6 +1100,9 @@ declare class Map1<KEY1, VALUE> implements KVComponent<[KEY1], VALUE> {
|
|
|
820
1100
|
toString(): string;
|
|
821
1101
|
}
|
|
822
1102
|
|
|
1103
|
+
/**
|
|
1104
|
+
* A Map implementation mapping a double key to a value.
|
|
1105
|
+
*/
|
|
823
1106
|
declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE> {
|
|
824
1107
|
private map1;
|
|
825
1108
|
constructor();
|
|
@@ -846,7 +1129,7 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
846
1129
|
kvKeys(): IterableIterator<[KEY1, KEY2]>;
|
|
847
1130
|
kvValues(): IterableIterator<VALUE>;
|
|
848
1131
|
kvEntries(): IterableIterator<[[KEY1, KEY2], VALUE]>;
|
|
849
|
-
[Symbol.iterator]():
|
|
1132
|
+
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, VALUE]>;
|
|
850
1133
|
clone(): Map2<KEY1, KEY2, VALUE>;
|
|
851
1134
|
merge(other: Map2<KEY1, KEY2, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2) => VALUE): this;
|
|
852
1135
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2) => boolean): boolean;
|
|
@@ -861,6 +1144,9 @@ declare class Map2<KEY1, KEY2, VALUE> implements KVComponent<[KEY1, KEY2], VALUE
|
|
|
861
1144
|
toString(): string;
|
|
862
1145
|
}
|
|
863
1146
|
|
|
1147
|
+
/**
|
|
1148
|
+
* A Map implementation mapping a triple key to a value.
|
|
1149
|
+
*/
|
|
864
1150
|
declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2, KEY3], VALUE> {
|
|
865
1151
|
private map1;
|
|
866
1152
|
constructor();
|
|
@@ -888,7 +1174,7 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2,
|
|
|
888
1174
|
kvKeys(): IterableIterator<[KEY1, KEY2, KEY3]>;
|
|
889
1175
|
kvValues(): IterableIterator<VALUE>;
|
|
890
1176
|
kvEntries(): IterableIterator<[[KEY1, KEY2, KEY3], VALUE]>;
|
|
891
|
-
[Symbol.iterator]():
|
|
1177
|
+
[Symbol.iterator](): IterableIterator<[KEY1, KEY2, KEY3, VALUE]>;
|
|
892
1178
|
clone(): Map3<KEY1, KEY2, KEY3, VALUE>;
|
|
893
1179
|
merge(other: Map3<KEY1, KEY2, KEY3, VALUE>, conflictResolver?: (oldValue: VALUE, newValue: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => VALUE): this;
|
|
894
1180
|
some(fn: (value: VALUE, key1: KEY1, key2: KEY2, key3: KEY3) => boolean): boolean;
|
|
@@ -903,6 +1189,9 @@ declare class Map3<KEY1, KEY2, KEY3, VALUE> implements KVComponent<[KEY1, KEY2,
|
|
|
903
1189
|
toString(): string;
|
|
904
1190
|
}
|
|
905
1191
|
|
|
1192
|
+
/**
|
|
1193
|
+
* Wrapper class of a key-value container that contain array values.
|
|
1194
|
+
*/
|
|
906
1195
|
declare class MultiContainer<K extends any[], V> {
|
|
907
1196
|
private readonly base;
|
|
908
1197
|
constructor(base: KVComponent<K, V[]>);
|
|
@@ -919,10 +1208,14 @@ declare class MultiContainer<K extends any[], V> {
|
|
|
919
1208
|
toString(): string;
|
|
920
1209
|
}
|
|
921
1210
|
/**
|
|
1211
|
+
* Create a multi-container.
|
|
1212
|
+
*
|
|
922
1213
|
* ```ts
|
|
923
1214
|
* // Usage:
|
|
924
1215
|
* const multi = asMulti(new Map2<string, string, number[]>());
|
|
925
|
-
* multi.add("
|
|
1216
|
+
* multi.add("a", "b", 5);
|
|
1217
|
+
* multi.add("a", "b", 10);
|
|
1218
|
+
* multi.add("a", "c", 15);
|
|
926
1219
|
* ```
|
|
927
1220
|
* @param base
|
|
928
1221
|
* @returns
|
|
@@ -932,7 +1225,7 @@ declare function asMulti<K extends any[], VALUE>(base: KVComponent<K, VALUE[]>):
|
|
|
932
1225
|
/**
|
|
933
1226
|
* Vec2 class.
|
|
934
1227
|
*
|
|
935
|
-
* @deprecated - Use Vec instead
|
|
1228
|
+
* @deprecated - Use {@link Vec} instead.
|
|
936
1229
|
*/
|
|
937
1230
|
declare class Vec2 {
|
|
938
1231
|
readonly x: number;
|
|
@@ -946,6 +1239,8 @@ declare class Vec2 {
|
|
|
946
1239
|
}
|
|
947
1240
|
|
|
948
1241
|
/**
|
|
1242
|
+
* @deprecated - Use {@link SignedIndexArray} or {@link IndexArray} instead, they have way more functions.
|
|
1243
|
+
*
|
|
949
1244
|
* A cache-like structure optimized for small-range integer keys, including negatives.
|
|
950
1245
|
*
|
|
951
1246
|
* Internally implemented using two sparse arrays: one for non-negative keys,
|
|
@@ -963,8 +1258,6 @@ declare class Vec2 {
|
|
|
963
1258
|
* cache.set(3, 'B');
|
|
964
1259
|
* console.log(cache.get(-2)); // 'A'
|
|
965
1260
|
* ```
|
|
966
|
-
*
|
|
967
|
-
* @deprecated - Same functionality an more is available now in SignedIndexArray<VALUE> and IndexArray<VALUE> containers.
|
|
968
1261
|
*/
|
|
969
1262
|
declare class SmallIntCache<VALUE> {
|
|
970
1263
|
private pos;
|
|
@@ -977,4 +1270,4 @@ declare class SmallIntCache<VALUE> {
|
|
|
977
1270
|
clear(): void;
|
|
978
1271
|
}
|
|
979
1272
|
|
|
980
|
-
export { Assert, Cookies, Device, DivRect, IndexArray, type KVComponent, LRUCache, Map1, Map2, Map3, MultiContainer, SignedIndexArray, SmallIntCache, Stack, index as Utils, Vec, Vec2, asMulti };
|
|
1273
|
+
export { index$7 as Assert, cookies as Cookies, device as Device, DivRect, Guard, IndexArray, type KVComponent, LRUCache, Map1, Map2, Map3, MultiContainer, SignedIndexArray, SmallIntCache, Stack, index as Utils, Vec, Vec2, asMulti };
|