@zelgadis87/utils-core 5.2.12 → 5.3.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.
Files changed (74) hide show
  1. package/.rollup/index.cjs +3267 -0
  2. package/.rollup/index.cjs.map +1 -0
  3. package/.rollup/index.d.ts +1303 -0
  4. package/.rollup/index.mjs +3088 -0
  5. package/.rollup/index.mjs.map +1 -0
  6. package/.rollup/tsconfig.tsbuildinfo +1 -0
  7. package/CHANGELOG.md +10 -0
  8. package/package.json +6 -8
  9. package/src/utils/arrays.ts +3 -1
  10. package/dist/Logger.d.ts +0 -22
  11. package/dist/Optional.d.ts +0 -108
  12. package/dist/async/CancelableDeferred.d.ts +0 -17
  13. package/dist/async/Deferred.d.ts +0 -32
  14. package/dist/async/RateThrottler.d.ts +0 -13
  15. package/dist/async/Semaphore.d.ts +0 -17
  16. package/dist/async/_index.d.ts +0 -3
  17. package/dist/index.d.ts +0 -8
  18. package/dist/lazy/Lazy.d.ts +0 -22
  19. package/dist/lazy/LazyAsync.d.ts +0 -24
  20. package/dist/lazy/LazyDictionary.d.ts +0 -9
  21. package/dist/lazy/_index.d.ts +0 -3
  22. package/dist/sorting/ComparisonChain.d.ts +0 -57
  23. package/dist/sorting/Sorter.d.ts +0 -121
  24. package/dist/sorting/_index.d.ts +0 -2
  25. package/dist/sorting/types.d.ts +0 -5
  26. package/dist/time/RandomTimeDuration.d.ts +0 -9
  27. package/dist/time/TimeBase.d.ts +0 -49
  28. package/dist/time/TimeDuration.d.ts +0 -71
  29. package/dist/time/TimeFrequency.d.ts +0 -10
  30. package/dist/time/TimeInstant.d.ts +0 -174
  31. package/dist/time/TimeInstantBuilder.d.ts +0 -72
  32. package/dist/time/TimeRange.d.ts +0 -11
  33. package/dist/time/TimeUnit.d.ts +0 -15
  34. package/dist/time/_index.d.ts +0 -8
  35. package/dist/time/constants.d.ts +0 -14
  36. package/dist/time/types.d.ts +0 -29
  37. package/dist/tsconfig.tsbuildinfo +0 -1
  38. package/dist/upgrade/DataUpgrader.d.ts +0 -22
  39. package/dist/upgrade/_index.d.ts +0 -2
  40. package/dist/upgrade/errors.d.ts +0 -12
  41. package/dist/upgrade/getTransitionsPath.d.ts +0 -3
  42. package/dist/upgrade/types.d.ts +0 -31
  43. package/dist/utils/_index.d.ts +0 -15
  44. package/dist/utils/arrays/groupBy.d.ts +0 -9
  45. package/dist/utils/arrays/indexBy.d.ts +0 -7
  46. package/dist/utils/arrays/statistics.d.ts +0 -8
  47. package/dist/utils/arrays/uniqBy.d.ts +0 -4
  48. package/dist/utils/arrays.d.ts +0 -71
  49. package/dist/utils/booleans.d.ts +0 -2
  50. package/dist/utils/css.d.ts +0 -14
  51. package/dist/utils/empties.d.ts +0 -18
  52. package/dist/utils/errors/withTryCatch.d.ts +0 -4
  53. package/dist/utils/errors.d.ts +0 -20
  54. package/dist/utils/functions/_index.d.ts +0 -3
  55. package/dist/utils/functions/constant.d.ts +0 -11
  56. package/dist/utils/functions/iff.d.ts +0 -8
  57. package/dist/utils/functions/predicateBuilder.d.ts +0 -7
  58. package/dist/utils/functions.d.ts +0 -41
  59. package/dist/utils/json.d.ts +0 -11
  60. package/dist/utils/nulls.d.ts +0 -9
  61. package/dist/utils/numbers/round.d.ts +0 -8
  62. package/dist/utils/numbers.d.ts +0 -35
  63. package/dist/utils/operations.d.ts +0 -28
  64. package/dist/utils/primitives.d.ts +0 -3
  65. package/dist/utils/promises.d.ts +0 -10
  66. package/dist/utils/random.d.ts +0 -3
  67. package/dist/utils/records/entries.d.ts +0 -7
  68. package/dist/utils/records.d.ts +0 -63
  69. package/dist/utils/strings/StringParts.d.ts +0 -38
  70. package/dist/utils/strings.d.ts +0 -20
  71. package/esbuild/index.cjs +0 -3380
  72. package/esbuild/index.cjs.map +0 -7
  73. package/esbuild/index.mjs +0 -3177
  74. package/esbuild/index.mjs.map +0 -7
@@ -0,0 +1,1303 @@
1
+ interface ICancelable {
2
+ cancel(): void;
3
+ }
4
+ interface ICancelablePromise<T> extends Promise<T>, ICancelable {
5
+ }
6
+ declare class DeferredCanceledError extends Error {
7
+ constructor();
8
+ }
9
+ declare class Deferred<T = void> implements ICancelablePromise<T> {
10
+ private _pending;
11
+ private readonly _internals;
12
+ get pending(): boolean;
13
+ constructor();
14
+ resolve(val: T): void;
15
+ reject(reason: Error): void;
16
+ cancel(): void;
17
+ resolveIfPending(val: T): void;
18
+ rejectIfPending(reason: Error): void;
19
+ cancelIfPending(): void;
20
+ then<R = T, S = T>(onFulfilled: ((value: T) => R | PromiseLike<R>) | null | undefined, onRejected?: ((reason: Error) => S | PromiseLike<S>) | null | undefined): Promise<R | S>;
21
+ catch<R = T>(onRejected: ((reason: Error) => R | PromiseLike<R>) | null | undefined): Promise<T | R>;
22
+ finally(onfinally: (() => void) | null | undefined): Promise<T>;
23
+ asPromise(): Promise<T>;
24
+ asCancelablePromise(): ICancelablePromise<T>;
25
+ protected createInternals(): {
26
+ promise: Promise<T>;
27
+ resolve: (value: T) => void;
28
+ reject: (reason: Error) => void;
29
+ };
30
+ get [Symbol.toStringTag](): string;
31
+ }
32
+
33
+ declare function constant<T>(v: T): () => T;
34
+ declare function identity<T>(t: T): T;
35
+
36
+ declare const constantNull: () => null;
37
+ declare const constantTrue: () => boolean;
38
+ declare const constantFalse: () => boolean;
39
+ declare const constantUndefined: () => undefined;
40
+ declare const alwaysTrue: () => boolean;
41
+ declare const alwaysFalse: () => boolean;
42
+ declare const constantZero: () => number;
43
+ declare const constantOne: () => number;
44
+
45
+ type TBooleanOrPredicate = boolean | TPredicate<void>;
46
+ type TIff<T> = {
47
+ elseIf<R>(pred: TBooleanOrPredicate, valueIfTrue: R): TIff<T | R>;
48
+ otherwise<R>(valueIfElse: R): T | R;
49
+ };
50
+ declare function iff<T>(firstPredicate: TBooleanOrPredicate, valueIfTrue: T): TIff<T>;
51
+
52
+ declare class PredicateBuilder<T> {
53
+ private _currentPredicate;
54
+ and(predicate: TPredicate<T>): this;
55
+ or(predicate: TPredicate<T>): this;
56
+ toPredicate(): TPredicate<T>;
57
+ }
58
+
59
+ type TFunction<A, R> = (a: A) => R;
60
+ type TTransformer<A, R> = TFunction<A, R>;
61
+ type TVoidFunction = TFunction<void, void>;
62
+ type TProducer<R> = TFunction<void, R>;
63
+ type TConsumer<T> = TFunction<T, void>;
64
+ type TPredicate<T> = TFunction<T, boolean>;
65
+ type TTypePredicate<T, R extends T> = (t: T) => t is R;
66
+ type TIdentityFunction<T> = TFunction<T, T>;
67
+ type TBiFunction<A, B, R> = (a: A, b: B) => R;
68
+ type TBiConsumer<A, B> = TBiFunction<A, B, void>;
69
+ type TBiPredicate<T> = TBiFunction<T, T, boolean>;
70
+ type TAccumulator<A, B> = TBiFunction<A, B, A>;
71
+ type TAsyncFunction<A, R> = TFunction<A, Promise<R>>;
72
+ type TAsyncVoidFunction = TAsyncFunction<void, void>;
73
+ type TAsyncProducer<R> = TAsyncFunction<void, R>;
74
+ type TAsyncConsumer<T> = TAsyncFunction<T, void>;
75
+ type TAsyncPredicate<T> = TAsyncFunction<T, boolean>;
76
+ type TAsyncBiFunction<A, B, R> = TBiFunction<A, B, Promise<R>>;
77
+ type TAsyncBiConsumer<A, B> = TAsyncBiFunction<A, B, void>;
78
+ type TAsyncBiPredicate<T> = TAsyncBiFunction<T, T, boolean>;
79
+ type TAnyFunction<R> = (...args: unknown[]) => R;
80
+ type TAsyncAnyFunction<R> = (...args: unknown[]) => Promise<R>;
81
+ declare function isFunction(t: unknown): t is Function;
82
+ declare function noop(): void;
83
+ declare function filterWithTypePredicate<T, R extends T>(filter: TPredicate<T>): TTypePredicate<T, R>;
84
+ declare function not<T>(predicate: TPredicate<T>): TPredicate<T>;
85
+ declare function and<T>(a: TPredicate<T>, b: TPredicate<T>): TPredicate<T>;
86
+ declare function or<T>(a: TPredicate<T>, b: TPredicate<T>): TPredicate<T>;
87
+ declare function xor<T>(a: TPredicate<T>, b: TPredicate<T>): TPredicate<T>;
88
+ declare function pipedInvoke<T, A>(op1: TFunction<T, A>): TFunction<T, A>;
89
+ declare function pipedInvoke<T, A, B>(op1: TFunction<T, A>, op2: TFunction<A, B>): TFunction<T, B>;
90
+ declare function pipedInvoke<T, A, B, C>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>): TFunction<T, C>;
91
+ declare function pipedInvoke<T, A, B, C, D>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>): TFunction<T, D>;
92
+ declare function pipedInvoke<T, A, B, C, D, E>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>): TFunction<T, E>;
93
+ declare function pipedInvoke<T, A, B, C, D, E, F>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>): TFunction<T, F>;
94
+ declare function pipedInvoke<T, A, B, C, D, E, F, G>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G>): TFunction<T, G>;
95
+ declare function pipedInvoke<T, A, B, C, D, E, F, G, H>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G>, op8: TFunction<G, H>): TFunction<T, H>;
96
+ declare function pipedInvoke<T, A, B, C, D, E, F, G, H, I>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G>, op8: TFunction<G, H>, op9: TFunction<H, I>): TFunction<T, I>;
97
+ declare function pipedInvoke<T, A, B, C, D, E, F, G, H, I>(op1: TFunction<T, A>, op2: TFunction<A, B>, op3: TFunction<B, C>, op4: TFunction<C, D>, op5: TFunction<D, E>, op6: TFunction<E, F>, op7: TFunction<F, G>, op8: TFunction<G, H>, op9: TFunction<H, I>, ...operations: TFunction<any, any>[]): TFunction<T, unknown>;
98
+ declare function pipedInvokeFromArray<T, R>(fns: Array<TFunction<any, any>>): TFunction<any, any>;
99
+
100
+ declare class Optional<T> implements TOptional<T> {
101
+ private _present;
102
+ private _value;
103
+ private constructor();
104
+ getRawValue(): T | undefined;
105
+ get(): T;
106
+ getOrElseThrow(errorProducer: TProducer<Error>): T;
107
+ set(t: T): void;
108
+ protected setNullable(t: T | null | undefined): void | this;
109
+ clear(): void;
110
+ isEmpty(): this is TEmptyOptional<T>;
111
+ isPresent(): this is TPresentOptional<T>;
112
+ ifEmpty(callback: TVoidFunction): void;
113
+ ifPresent(callback: TConsumer<T>): void;
114
+ ifPresentThenClear(callback: TConsumer<T>): void;
115
+ apply(callbackIfPresent: TConsumer<T>, callbackIfEmpty: TVoidFunction): any;
116
+ orElseReturn(newValue: T): T;
117
+ orElse: (newValue: T) => T;
118
+ orElseProduce(newValueProducer: TProducer<T>): T;
119
+ orElseGet: (newValueProducer: TProducer<T>) => T;
120
+ orElseReturnAndApply(newValue: T): T;
121
+ orElseProduceAndApply(newValueProducer: TProducer<T>): T;
122
+ orElseReturnNullableAndApply(newValue: T | null | undefined): TOptional<T>;
123
+ orElseProduceNullableAndApply(newValueProducer: TProducer<T | null | undefined>): TOptional<T>;
124
+ orElseReturnNullable(newValue: T | null | undefined): any;
125
+ orElseNullable: (newValue: T | null | undefined) => any;
126
+ orElseProduceNullable(newValueProducer: TProducer<T | null | undefined>): any;
127
+ orElseGetNullable: (newValueProducer: TProducer<T | null | undefined>) => any;
128
+ orElseThrow(errorProducer: TProducer<Error>): TPresentOptional<T>;
129
+ throwIfPresent(errorProducer: TFunction<T, Error>): any;
130
+ mapTo<R>(mapper: TFunction<T, R | null | undefined>): any;
131
+ flatMapTo<R>(mapper: TFunction<T, TOptional<R>>): any;
132
+ filter(predicate: TPredicate<T>): this | TEmptyOptional<T>;
133
+ static empty<T>(): TEmptyOptional<T>;
134
+ static of<T>(t: T): TPresentOptional<T>;
135
+ static ofNullable<T>(t: T | null | undefined): TOptional<T>;
136
+ }
137
+
138
+ type TOptional<T> = {
139
+ /**
140
+ * @returns the currently stored value, if any; throws {@link ErrorGetEmptyOptional} otherwise;
141
+ */
142
+ get(): T;
143
+ /**
144
+ * @returns the currently stored value, if any; returns undefined otherwise;
145
+ */
146
+ getRawValue(): T | undefined;
147
+ /**
148
+ * @returns the currently stored value, if any; throws the error generated by errorProducer otherwise;
149
+ */
150
+ getOrElseThrow: (errorProducer: TProducer<Error>) => T;
151
+ /**
152
+ * Places a new value inside this optional. Throws {@link ErrorSetEmptyOptional} if t is null or undefined.
153
+ */
154
+ set(t: T): void;
155
+ /**
156
+ * Clears the current value from this optional, if any.
157
+ */
158
+ clear(): void;
159
+ isEmpty(): boolean;
160
+ isPresent(): boolean;
161
+ ifEmpty(callback: TVoidFunction): void;
162
+ ifPresent(callback: TConsumer<T>): void;
163
+ apply<RP = void, RE = void>(callbackIfPresent: TFunction<T, RP>, callbackIfEmpty: TProducer<RE>): RP | RE;
164
+ throwIfPresent: (errorGenerator: TFunction<T, Error>) => TEmptyOptional<T>;
165
+ /** @deprecated[2025.07.25]: Replace with {@link orElseReturn} (drop-in replacement) */
166
+ orElse: (newValue: T) => T;
167
+ /** @deprecated[2025.07.25]: Replace with {@link orElseProduce} (drop-in replacement) */
168
+ orElseGet: (newValueProducer: TProducer<T>) => T;
169
+ /** @deprecated[2025.07.25]: Replace with {@link orElseReturnNullabe} (drop-in replacement) */
170
+ orElseNullable: (newValue: T | null | undefined) => TOptional<T>;
171
+ /** @deprecated[2025.07.25]: Replace with {@link orElseProduceNullable} (drop-in replacement) */
172
+ orElseGetNullable: (newValueProducer: TProducer<T | null | undefined>) => TOptional<T>;
173
+ orElseReturn: (newValue: T) => T;
174
+ orElseProduce: (newValueProducer: TProducer<T>) => T;
175
+ orElseReturnNullable: (newValue: T | null | undefined) => TOptional<T>;
176
+ orElseProduceNullable: (newValueProducer: TProducer<T | null | undefined>) => TOptional<T>;
177
+ orElseReturnAndApply: (newValue: T) => T;
178
+ orElseProduceAndApply: (newValueProducer: TProducer<T>) => T;
179
+ orElseReturnNullableAndApply: (newValue: T | null | undefined) => TOptional<T>;
180
+ orElseProduceNullableAndApply: (newValueProducer: TProducer<T | null | undefined>) => TOptional<T>;
181
+ orElseThrow: (errorProducer: TProducer<Error>) => TPresentOptional<T>;
182
+ mapTo<R>(mapper: TFunction<T, R>): TOptional<R>;
183
+ flatMapTo<R>(mapper: TFunction<T, TOptional<R>>): TOptional<R>;
184
+ filter(predicate: TPredicate<T>): TOptional<T>;
185
+ };
186
+ type TEmptyOptional<T> = TOptional<T> & {
187
+ get(): never;
188
+ isEmpty(): true;
189
+ isPresent(): false;
190
+ apply<RP = void, RE = void>(callbackIfPresent: TFunction<T, RP>, callbackIfEmpty: TProducer<RE>): RE;
191
+ };
192
+ type TPresentOptional<T> = TOptional<T> & {
193
+ get(): T;
194
+ isEmpty(): false;
195
+ isPresent(): true;
196
+ apply<RP = void, RE = void>(callbackIfPresent: TFunction<T, RP>, callbackIfEmpty: TProducer<RE>): RP;
197
+ };
198
+ declare class ErrorGetEmptyOptional extends Error {
199
+ constructor();
200
+ }
201
+ declare class ErrorSetEmptyOptional extends Error {
202
+ constructor();
203
+ }
204
+ declare class ErrorCannotInstantiatePresentOptionalWithEmptyValue extends Error {
205
+ constructor();
206
+ }
207
+
208
+ declare class TimeUnit {
209
+ readonly multiplier: number;
210
+ private constructor();
211
+ toUnit(value: number, unit: TimeUnit): number;
212
+ toMs(value: number): number;
213
+ toSeconds(value: number): number;
214
+ toMinutes(value: number): number;
215
+ toHours(value: number): number;
216
+ toDays(value: number): number;
217
+ static readonly MILLISECONDS: TimeUnit;
218
+ static readonly SECONDS: TimeUnit;
219
+ static readonly MINUTES: TimeUnit;
220
+ static readonly HOURS: TimeUnit;
221
+ static readonly DAYS: TimeUnit;
222
+ }
223
+
224
+ type TTimeInUnits = {
225
+ milliseconds: number;
226
+ seconds: number;
227
+ minutes: number;
228
+ hours: number;
229
+ days: number;
230
+ };
231
+ declare abstract class TimeBase<T> {
232
+ private readonly _ms;
233
+ protected constructor(value: number, unit: TimeUnit);
234
+ protected abstract create(value: number, unit: TimeUnit): T;
235
+ /**
236
+ * Total number of milliseconds, rounded down.
237
+ */
238
+ get ms(): number;
239
+ /**
240
+ * Total number of seconds, rounded down.
241
+ */
242
+ get seconds(): number;
243
+ /**
244
+ * Total number of minutes, rounded down.
245
+ */
246
+ get minutes(): number;
247
+ /**
248
+ * Total number of hours, rounded down.
249
+ */
250
+ get hours(): number;
251
+ /**
252
+ * Total number of days, rounded down.
253
+ */
254
+ get days(): number;
255
+ addMs(milliseconds: number): T;
256
+ addSeconds(seconds: number): T;
257
+ addMinutes(minutes: number): T;
258
+ addHours(hours: number): T;
259
+ addDays(days: number): T;
260
+ removeDays(days: number): T;
261
+ addUnits(n: number, unit: TimeUnit): T;
262
+ removeMs(milliseconds: number): T;
263
+ removeSeconds(seconds: number): T;
264
+ removeMinutes(minutes: number): T;
265
+ removeHours(hours: number): T;
266
+ removeUnits(n: number, unit: TimeUnit): T;
267
+ getUnit(unit: TimeUnit): number;
268
+ protected toUnits(): TTimeInUnits;
269
+ protected static unitsToMs(units: Partial<TTimeInUnits>): number;
270
+ toJSON(): number;
271
+ }
272
+
273
+ declare const monthNames: {
274
+ readonly january: 1;
275
+ readonly february: 2;
276
+ readonly march: 3;
277
+ readonly april: 4;
278
+ readonly may: 5;
279
+ readonly june: 6;
280
+ readonly july: 7;
281
+ readonly august: 8;
282
+ readonly september: 9;
283
+ readonly october: 10;
284
+ readonly november: 11;
285
+ readonly december: 12;
286
+ };
287
+
288
+ type TOneDigit = `${TDigit}`;
289
+ type TTwoDigits = `${TDigit}${TDigit}`;
290
+ type TThreeDigits = `${TDigit}${TDigit}${TDigit}`;
291
+ type TFourDigits = `${TDigit}${TDigit}${TDigit}${TDigit}`;
292
+ type TUpToTwoDigits = TOneDigit | `${TDigit1_9}${TDigit}`;
293
+ type TUpToThreeDigits = TUpToTwoDigits | `${TDigit1_9}${TDigit}${TDigit}`;
294
+ type TUpToFourDigits = TUpToThreeDigits | `${TDigit1_9}${TDigit}${TDigit}${TDigit}`;
295
+ type TTwoDigitsMonth = TTwoDigits & TParseableInt<`0${TDigit1_9}` | '10' | '11' | '12'>;
296
+ type TTwoDigitsDate = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | '30' | '31'>;
297
+ type TTwoDigitsHour = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | '20' | '21' | '22' | '23' | '24'>;
298
+ type TTwoDigitsMinute = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | `3${TDigit}` | `4${TDigit}` | `5${TDigit}`>;
299
+ type TTwoDigitsSecond = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | `3${TDigit}` | `4${TDigit}` | `5${TDigit}`>;
300
+ type TThreeDigitsMillisecond = TThreeDigits;
301
+ type TFourDigitsYear = TFourDigits;
302
+ type TFourDigitsMillisecond = `${'+' | '-'}${TThreeDigits}`;
303
+ type TYear = TPositiveNumber;
304
+ type TMonth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
305
+ type TMonthName = keyof typeof monthNames;
306
+ type TDayOfMonth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31;
307
+ type TWeekNumber = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53;
308
+ type TDayOfWeek = 1 | 2 | 3 | 4 | 5 | 6 | 7;
309
+ type THourOfDay = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23;
310
+ type TMinuteOfHour = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59;
311
+ type TSecondOfMinute = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59;
312
+ type TMillisecondOfSecond = TNumber0_1000;
313
+ type TIso8601DateString = `${string}-${string}-${string}T${string}:${string}:${string}.${string}${string}`;
314
+ type TIso8601DateUtcString = `${string}-${string}-${string}T${string}:${string}:${string}.${string}Z`;
315
+
316
+ type TRelativeSignum = '+' | '-';
317
+ type TRelativeNumber = `${TRelativeSignum}${TUpToTwoDigits}`;
318
+ type TTimeInstantParameters = {
319
+ year: TYear;
320
+ month: TMonth;
321
+ date: TDayOfMonth;
322
+ hours: THourOfDay;
323
+ minutes: TMinuteOfHour;
324
+ seconds: TSecondOfMinute;
325
+ milliseconds: TMillisecondOfSecond;
326
+ };
327
+ type TTimeInstantCreationParameters = {
328
+ year: TTimeInstantParameters["year"] | {
329
+ absolute: TTimeInstantParameters["year"];
330
+ } | TRelativeNumber | {
331
+ relative: number;
332
+ relativeTo: 'now' | TimeInstant;
333
+ } | 'next' | 'last' | 'current' | undefined;
334
+ month: TTimeInstantParameters["month"] | {
335
+ absolute: TTimeInstantParameters["month"];
336
+ } | TMonthName | TRelativeNumber | {
337
+ relative: number;
338
+ relativeTo: 'now' | TimeInstant;
339
+ } | 'next' | 'last' | 'current' | undefined;
340
+ date: TTimeInstantParameters["date"] | {
341
+ absolute: TTimeInstantParameters["date"];
342
+ } | TRelativeNumber | {
343
+ relative: number;
344
+ relativeTo: 'now' | TimeInstant;
345
+ } | 'next' | 'last' | 'current' | undefined;
346
+ hours: TTimeInstantParameters["hours"] | {
347
+ absolute: TTimeInstantParameters["hours"];
348
+ } | TRelativeNumber | {
349
+ relative: number;
350
+ relativeTo: 'now' | TimeInstant;
351
+ } | 'next' | 'last' | 'current' | undefined;
352
+ minutes: TTimeInstantParameters["minutes"] | {
353
+ absolute: TTimeInstantParameters["minutes"];
354
+ } | TRelativeNumber | {
355
+ relative: number;
356
+ relativeTo: 'now' | TimeInstant;
357
+ } | 'next' | 'last' | 'current' | undefined;
358
+ seconds: TTimeInstantParameters["seconds"] | {
359
+ absolute: TTimeInstantParameters["seconds"];
360
+ } | TRelativeNumber | {
361
+ relative: number;
362
+ relativeTo: 'now' | TimeInstant;
363
+ } | 'next' | 'last' | 'current' | undefined;
364
+ milliseconds: TTimeInstantParameters["milliseconds"] | {
365
+ absolute: TTimeInstantParameters["milliseconds"];
366
+ } | TRelativeNumber | {
367
+ relative: number;
368
+ relativeTo: 'now' | TimeInstant;
369
+ } | 'next' | 'last' | 'current' | undefined;
370
+ };
371
+ declare function timeInstantBuilder(): {
372
+ year: (x: TTimeInstantCreationParameters["year"]) => /*elided*/ any;
373
+ month: (x: TTimeInstantCreationParameters["month"]) => /*elided*/ any;
374
+ date: (x: TTimeInstantCreationParameters["date"]) => /*elided*/ any;
375
+ hours: (x: TTimeInstantCreationParameters["hours"]) => /*elided*/ any;
376
+ minutes: (x: TTimeInstantCreationParameters["minutes"]) => /*elided*/ any;
377
+ seconds: (x: TTimeInstantCreationParameters["seconds"]) => /*elided*/ any;
378
+ milliseconds: (x: TTimeInstantCreationParameters["milliseconds"]) => /*elided*/ any;
379
+ values: (x: Partial<TTimeInstantCreationParameters>) => /*elided*/ any;
380
+ relativeTo: (x: TimeInstant | Date) => /*elided*/ any;
381
+ build: () => TimeInstant;
382
+ };
383
+ type TTimeInstantBuilder = ReturnType<typeof timeInstantBuilder>;
384
+
385
+ declare class TimeInstant extends TimeBase<TimeInstant> {
386
+ protected constructor(number: number, unit: TimeUnit);
387
+ protected create(value: number, unit: TimeUnit): TimeInstant;
388
+ addDuration(duration: TimeDuration): TimeInstant;
389
+ removeDuration(duration: TimeDuration): TimeInstant;
390
+ distanceFrom(instant: TimeInstant): TimeDuration;
391
+ distanceFromNow(): TimeDuration;
392
+ distanceFromUnixTimestamp(timestamp: number): TimeDuration;
393
+ timeLeftFrom(instant: TimeInstant): TimeDuration;
394
+ timeLeftFromNow(): TimeDuration;
395
+ distanceFromStartOfDay(): TimeDuration;
396
+ atStartOfDay(): TimeInstant;
397
+ distanceFromEndOfDay(): TimeDuration;
398
+ atEndOfDay(): TimeInstant;
399
+ promise(): Promise<void>;
400
+ cancelablePromise(): ICancelablePromise<void>;
401
+ delay(cb: () => unknown): void;
402
+ cancelableDelay(cb: () => unknown): ICancelable;
403
+ ensureInTheFuture(): void;
404
+ ensureInThePast(): void;
405
+ isToday(): boolean;
406
+ /**
407
+ * Formats this instant using the given pattern. The pattern can contain the following tokens:
408
+ *
409
+ * Note: Implementation inspired by the small-date library (https://github.com/robinweser/small-date).
410
+ *
411
+ * | Token | Description | Example |
412
+ * |:------|:--------------------------------|:------------------------------|
413
+ * | D | Weekday, 1 letter | W |
414
+ * | DD | Weekday, 3 letters | Wed |
415
+ * | DDD | Weekday, long | Wednesday |
416
+ * | d | Day of the month, no padding | 3 |
417
+ * | dd | Day of the month, padded to 2 | 03 |
418
+ * | M | Month, numeric | 3 |
419
+ * | MM | Month, 2 digits | 03 |
420
+ * | MMM | Month, 3 letters | Mar |
421
+ * | MMMM | Month, long | March |
422
+ * | y | Year, numeric | 2021 |
423
+ * | yy | Year, 2 digits | 21 |
424
+ * | yyyy | Year, numeric | 2021 |
425
+ * | h | Hours, no padding | 6 |
426
+ * | hh | Hours, padded to 2 | 06 |
427
+ * | H | Hours in 24-format, no padding | 18 |
428
+ * | HH | Hours in 24-format, padded to 2 | 18 |
429
+ * | m | Minutes, no padding | 7 |
430
+ * | m | Minutes, padded to 2 | 07 |
431
+ * | s | Seconds, no padding | 8 |
432
+ * | ss | Seconds, padded to 2 | 08 |
433
+ * | S | Milliseconds, no padding | 9 |
434
+ * | SS | Milliseconds, padded to 2 | 09 |
435
+ * | SSS | Milliseconds, padded to 3 | 009 |
436
+ * | G | Era, narrow | A |
437
+ * | GG | Era, short | AD |
438
+ * | GGG | Era, long | Anno Domino |
439
+ * | Z | Time zone, short | GMT+1 |
440
+ * | ZZ | Time short, long C | entral European Standard Time |
441
+ * | P | Period of the day, narrow | in the morning |
442
+ * | PP | Period of the day, short | in the morning |
443
+ * | PPP | Period of the day, long | in the morning |
444
+ * | a | Meridiem | pm |
445
+ * @param pattern The pattern to use. Refer to the token table above for details.
446
+ * @param config An optional locale and timeZone definition to use during the format.
447
+ * @returns a string, formatted using the given pattern, at the given timeZone with the given locale.
448
+ */
449
+ format(pattern: string, config?: {
450
+ locale?: string;
451
+ timeZone?: string;
452
+ }): string;
453
+ /**
454
+ * Parses a date string using the given pattern and creates a TimeInstant.
455
+ * This method is the inverse of format() - parsing a formatted string should recreate the original instant.
456
+ *
457
+ * For partial patterns (e.g., time-only or date-only), the missing components are taken from the base instant.
458
+ * For example, parsing "14:30" with base set to yesterday at midnight will result in yesterday at 14:30.
459
+ *
460
+ * Note: Currently performs basic validation (e.g., month 1-12, day 1-31) but does not validate
461
+ * calendar-specific constraints (e.g., February 30th, April 31st). Invalid dates may be
462
+ * normalized by the underlying Date constructor.
463
+ *
464
+ * @param dateString The date string to parse
465
+ * @param pattern The pattern used to parse the string (same tokens as format())
466
+ * @param base The base TimeInstant to use for partial patterns (defaults to now)
467
+ * @param config An optional locale and timeZone definition to use during parsing
468
+ * @returns A TimeInstant parsed from the string
469
+ * @throws Error if the string doesn't match the pattern or contains invalid basic values
470
+ * @todo Add calendar-aware validation to reject dates like February 30th, April 31st
471
+ */
472
+ static fromString(dateString: string, pattern: string, base?: TimeInstant, config?: {
473
+ locale?: string;
474
+ timeZone?: string;
475
+ }): TimeInstant;
476
+ static parse(dateString: string, pattern: string, config?: {
477
+ locale?: string;
478
+ timeZone?: string;
479
+ }): Partial<TTimeInstantParameters>;
480
+ /**
481
+ * @returns this instant, in ISO 8601 format (eg, 2024-11-01T15:49:22.024Z). The format is meant to always be realiable.
482
+ */
483
+ asIso8601(): TIso8601DateUtcString;
484
+ /**
485
+ * @returns this instant, in a human readable format, containing both the date and the time. The format COULD change in the future, do NOT use this method for consistent outputs.
486
+ */
487
+ asHumanTimestamp(): string;
488
+ toUnixTimestamp(): number;
489
+ toDate(): Date;
490
+ toParameters(): TTimeInstantParameters;
491
+ /**
492
+ * @returns true if the instant is in the past, false otherwise
493
+ */
494
+ isInThePast(): boolean;
495
+ /**
496
+ * @returns true if the instant is in the future, false otherwise
497
+ */
498
+ isInTheFuture(): boolean;
499
+ isAfter(other: TimeInstant): boolean;
500
+ isBefore(other: TimeInstant): boolean;
501
+ compareTo(other: TimeInstant): TComparisonResult;
502
+ atTime(parameters: Partial<TTimeInstantCreationParameters & {
503
+ year: never;
504
+ month: never;
505
+ date: never;
506
+ }>): TimeInstant;
507
+ atDate(parameters: Partial<TTimeInstantCreationParameters & {
508
+ hours: never;
509
+ minutes: never;
510
+ seconds: never;
511
+ milliseconds: never;
512
+ }>): TimeInstant;
513
+ at(parameters: Partial<TTimeInstantCreationParameters>): TimeInstant;
514
+ isBetween(start: TimeInstant, end: TimeInstant): boolean;
515
+ static fromDate(date: Date): TimeInstant;
516
+ static fromUnixTimestamp(unixTimestamp: number): TimeInstant;
517
+ static fromUnixSeconds(unixSeconds: number): TimeInstant;
518
+ static fromParameters(parameters: Partial<TTimeInstantCreationParameters>, referenceDate?: Date | TimeInstant): TimeInstant;
519
+ static highest(instant1: TimeInstant, instant2: TimeInstant): TimeInstant;
520
+ static lowest(instant1: TimeInstant, instant2: TimeInstant): TimeInstant;
521
+ static builder(): TTimeInstantBuilder;
522
+ static fromIso8601(str: string): TimeInstant;
523
+ /**
524
+ * @deprecated [2025.10.19]: Use fromIso8601 instead.
525
+ */
526
+ static tryFromIso8601: typeof TimeInstant.fromIso8601;
527
+ static now(): TimeInstant;
528
+ static compare(a: TimeInstant, b: TimeInstant): TComparisonResult;
529
+ roundedToStartOf(unit: TimeUnit): TimeInstant;
530
+ roundedToEndOf(unit: TimeUnit): TimeInstant;
531
+ roundedToNext(unit: TimeUnit, factor?: number): TimeInstant;
532
+ roundedToPrevious(unit: TimeUnit, factor?: number): TimeInstant;
533
+ roundedTo(unit: TimeUnit, factor?: number): TimeInstant;
534
+ /**
535
+ * Returns the week number represented by this instant, according to the ISO 8601 standard.
536
+ * Please note that the instant and the week number could be of two different years, eg the friday 1st january is actually part of week 52 of the previous year.
537
+ */
538
+ get weekNumber(): {
539
+ weekNumber: TWeekNumber;
540
+ year: number;
541
+ };
542
+ /**
543
+ * This method is used to provide a better DX when inspecting a TimeInstant object in DevTools.
544
+ */
545
+ protected get _time(): string;
546
+ toString(): string;
547
+ static ZERO: TimeInstant;
548
+ static fromJSON(ms: number): TimeInstant;
549
+ }
550
+ declare function isTimeInstant(x: unknown): x is TimeInstant;
551
+
552
+ declare class TimeDuration extends TimeBase<TimeDuration> {
553
+ protected constructor(value: number, unit: TimeUnit);
554
+ protected create(value: number, unit: TimeUnit): TimeDuration;
555
+ addDuration(duration: TimeDuration): TimeDuration;
556
+ removeDuration(duration: TimeDuration): TimeDuration;
557
+ removeUnits(n: number, unit: TimeUnit): TimeDuration;
558
+ multiplyBy(times: number): TimeDuration;
559
+ divideBy(times: number): TimeDuration;
560
+ /**
561
+ * Returns the current duration in a human readable format, prioritizing the most significant unit of time and excluding the rest.
562
+ * @todo[2023-06] Should allow more customization options
563
+ * @todo[2023-06] By default should show the secondary unit only when actually needed (eg, 1h 20m & 3h, instead of 1h 20m & 3h 28m)
564
+ * @todo[2023-06] Should not allow negative durations, as this is a duration and not an instant.
565
+ * @returns the duration, with only the most significant units displayed as a human readable string, eg: 1d 20h, 10m 30s.
566
+ */
567
+ get formatted(): string;
568
+ interval(cb: () => unknown): TIntervalHandle;
569
+ timeout(cb: () => unknown): TTimeoutHandle;
570
+ cancelablePromise(): ICancelablePromise<void>;
571
+ promise(): Promise<void>;
572
+ delay(cb: () => unknown): void;
573
+ cancelableDelay(cb: () => unknown): ICancelable;
574
+ debounce<T>(fn: (t: T) => void): (t: T) => void;
575
+ toDigitalClock(): string;
576
+ get asSeconds(): string;
577
+ fromNow(): TimeInstant;
578
+ differenceFrom(other: TimeDuration): TimeDuration;
579
+ isGreaterThan(other: TimeDuration): boolean;
580
+ isLessThan(other: TimeDuration): boolean;
581
+ compareTo(other: TimeDuration): TComparisonResult;
582
+ atLeast(other: TimeDuration): TimeDuration;
583
+ atMost(other: TimeDuration): TimeDuration;
584
+ isEmpty(): boolean;
585
+ isNotEmpty(): boolean;
586
+ toUnits(): TTimeInUnits;
587
+ /**
588
+ * This method is used to provide a better DX when inspecting a TimeInstant object in DevTools.
589
+ */
590
+ protected get _duration(): string;
591
+ toString(): string;
592
+ static parseHumanTime(humanTime: string): TimeDuration;
593
+ static compare(a: TimeDuration, b: TimeDuration): TComparisonResult;
594
+ static ms: (value: number) => TimeDuration;
595
+ static seconds: (value: number) => TimeDuration;
596
+ static minutes: (value: number) => TimeDuration;
597
+ static hours: (value: number) => TimeDuration;
598
+ static days: (value: number) => TimeDuration;
599
+ static shamefulUnref: (ms: TAllowedTimeDuration) => number;
600
+ static shamefulRef: (ms: TAllowedTimeDuration) => TimeDuration;
601
+ static unref: (ms: TValidTimeDuration) => TPredefinedTimeDuration;
602
+ static ref: (ms: TValidTimeDuration) => TimeDuration;
603
+ static fromMs(ms: number): TimeDuration;
604
+ static distanceFromNow(instant: TimeInstant): TimeDuration;
605
+ static distance(instant1: TimeInstant, instant2: TimeInstant): TimeDuration;
606
+ static greatest(duration1: TimeDuration, duration2: TimeDuration): TimeDuration;
607
+ static lowest(duration1: TimeDuration, duration2: TimeDuration): TimeDuration;
608
+ static ZERO: TimeDuration;
609
+ static fromJSON(ms: number): TimeDuration;
610
+ static fromUnits(parameters: Partial<TTimeInUnits>): TimeDuration;
611
+ }
612
+ type TPredefinedTimeDuration = 0 | 50 | 100 | 150 | 200 | 250 | 300 | 500 | 1000 | 1500 | 2000 | 2500 | 5000;
613
+ type TValidTimeDuration = TimeDuration | TPredefinedTimeDuration;
614
+ type TAllowedTimeDuration = TValidTimeDuration | number;
615
+ declare function isAllowedTimeDuration(t: unknown): t is TAllowedTimeDuration;
616
+
617
+ type TComparisonResult = -1 | 0 | 1;
618
+ type TStrictComparisonResult = -1 | 1;
619
+ type TComparisonFunction<T> = TBiFunction<T, T, TComparisonResult>;
620
+ type TComparisonDirection = 'ASC' | 'DESC';
621
+
622
+ type TComparable<T> = {
623
+ compare: TComparisonFunction<T>;
624
+ };
625
+ type TSorter<T> = {
626
+ get then(): TSorterStep<T, TSorter<T>>;
627
+ reversed: () => TSorter<T>;
628
+ compare: TComparisonFunction<T>;
629
+ sort: (arr: TReadableArray<T>) => Array<T>;
630
+ top: (arr: TReadableArray<T>, n: TPositiveNumber) => Array<T>;
631
+ bottom: (arr: TReadableArray<T>, n: TPositiveNumber) => Array<T>;
632
+ first: (arr: TReadableArray<T>) => T | null;
633
+ last: (arr: TReadableArray<T>) => T | null;
634
+ };
635
+ type TSorterStepForRecords<T, Ret> = {
636
+ usingStrings: (field: TKeysOfType<T, string>) => TSorterStepUsing<string, Ret>;
637
+ usingNumbers: (field: TKeysOfType<T, number>) => TSorterStepUsing<number, Ret>;
638
+ usingBooleans: (field: TKeysOfType<T, boolean>) => TSorterStepUsing<boolean, Ret>;
639
+ usingDates: (field: TKeysOfType<T, Date>) => TSorterStepUsing<Date, Ret>;
640
+ usingTimeInstant: (field: TKeysOfType<T, TimeInstant>) => TSorterStepUsing<TimeInstant, Ret>;
641
+ usingTimeDuration: (field: TKeysOfType<T, TimeDuration>) => TSorterStepUsing<TimeDuration, Ret>;
642
+ };
643
+ type TSorterStepForNumbers<_T, Ret> = {
644
+ inAscendingOrder(opts?: {
645
+ nullsFirst?: boolean;
646
+ }): Ret;
647
+ inDescendingOrder(opts?: {
648
+ nullsFirst?: boolean;
649
+ }): Ret;
650
+ };
651
+ type TSorterStepForStrings<_T, Ret> = {
652
+ /** @deprecated: Use inLexographicalOrder instead */ inLexographicalOrder(opts?: {
653
+ nullsFirst?: boolean;
654
+ }): Ret;
655
+ /** @deprecated: Use inLexographicalOrderIgnoringCase instead */ inLexographicalOrderIgnoringCase(opts?: {
656
+ nullsFirst?: boolean;
657
+ }): Ret;
658
+ /** @deprecated: Use inReverseLexographicalOrder instead */ inReverseLexographicalOrder(opts?: {
659
+ nullsFirst?: boolean;
660
+ }): Ret;
661
+ /** @deprecated: Use inReverseLexographicalOrderIgnoringCase instead */ inReverseLexographicalOrderIgnoringCase(opts?: {
662
+ nullsFirst?: boolean;
663
+ }): Ret;
664
+ inLexicographicalOrder(opts?: {
665
+ nullsFirst?: boolean;
666
+ }): Ret;
667
+ inLexicographicalOrderIgnoringCase(opts?: {
668
+ nullsFirst?: boolean;
669
+ }): Ret;
670
+ inReverseLexicographicalOrder(opts?: {
671
+ nullsFirst?: boolean;
672
+ }): Ret;
673
+ inReverseLexicographicalOrderIgnoringCase(opts?: {
674
+ nullsFirst?: boolean;
675
+ }): Ret;
676
+ };
677
+ type TSorterStepForBooleans<_T, Ret> = {
678
+ truesFirst(opts?: {
679
+ nullsFirst?: boolean;
680
+ }): Ret;
681
+ falsesFirst(opts?: {
682
+ nullsFirst?: boolean;
683
+ }): Ret;
684
+ };
685
+ type TSorterStepForDates<_T, Ret> = {
686
+ oldestDateFirst(opts?: {
687
+ nullsFirst?: boolean;
688
+ }): Ret;
689
+ newestDateFirst(opts?: {
690
+ nullsFirst?: boolean;
691
+ }): Ret;
692
+ };
693
+ type TSorterStepForTimeInstant<_T, Ret> = {
694
+ oldestFirst(opts?: {
695
+ nullsFirst?: boolean;
696
+ }): Ret;
697
+ newestFirst(opts?: {
698
+ nullsFirst?: boolean;
699
+ }): Ret;
700
+ };
701
+ type TSorterStepForTimeDuration<_T, Ret> = {
702
+ longestFirst(opts?: {
703
+ nullsFirst?: boolean;
704
+ }): Ret;
705
+ shortestFirst(opts?: {
706
+ nullsFirst?: boolean;
707
+ }): Ret;
708
+ };
709
+ type TSorterStepForChainables<T, Ret> = {
710
+ chain: (chain: TComparable<T>) => Ret;
711
+ chainFunction: (fn: TComparisonFunction<T>) => Ret;
712
+ };
713
+ type TSorterStepForUsing<T, Ret> = {
714
+ using: <X>(transform: TFunction<T, X>) => TSorterStepUsing<X, Ret>;
715
+ };
716
+ type TSorterStepForPrioritizable<T extends string | number, Ret> = {
717
+ prioritizing(arr: T[], options?: TConditionalParameterOptions<TPrioritizeOptions, typeof defaultPrioritizeOptions>): Ret;
718
+ deprioritizing(arr: Array<T>, options?: TConditionalParameterOptions<TPrioritizeOptions, typeof defaultPrioritizeOptions>): Ret;
719
+ prioritizingWithEqualWeight(arr: T[], options?: TConditionalParameterOptions<TPrioritizeOptions, typeof defaultPrioritizeOptions>): Ret;
720
+ deprioritizingWithEqualWeight(arr: Array<T>, options?: TConditionalParameterOptions<TPrioritizeOptions, typeof defaultPrioritizeOptions>): Ret;
721
+ };
722
+ type TSorterStepUsing<T, Ret> = {} & (T extends Record<string | number | symbol, unknown> ? TSorterStepForRecords<T, Ret> : {}) & (T extends number ? TSorterStepForNumbers<T, Ret> : {}) & (T extends string ? TSorterStepForStrings<T, Ret> : {}) & (T extends boolean ? TSorterStepForBooleans<T, Ret> : {}) & (T extends Date ? TSorterStepForDates<T, Ret> : {}) & (T extends TimeInstant ? TSorterStepForTimeInstant<T, Ret> : {}) & (T extends TimeDuration ? TSorterStepForTimeDuration<T, Ret> : {}) & (T extends string ? TSorterStepForPrioritizable<string, Ret> : {}) & (T extends number ? TSorterStepForPrioritizable<number, Ret> : {});
723
+ type TSorterStep<T, Ret> = TSorterStepUsing<T, Ret> & TSorterStepForChainables<T, Ret> & TSorterStepForUsing<T, Ret>;
724
+ type TSorterStarter<T> = TSorterStepUsing<T, TSorter<T>> & TSorterStepForUsing<T, TSorter<T>> & {
725
+ usingFunction: (fn: TComparisonFunction<T>) => TSorter<T>;
726
+ };
727
+ type TSorterBuilder<T> = (builder: TSorterStarter<T>) => TSorter<T>;
728
+ type TPrioritizeOptions = {};
729
+ declare const defaultPrioritizeOptions: {};
730
+ declare const Sorter: {
731
+ createFor: <T>(_template?: T) => TSorterStarter<T>;
732
+ sort: <T>(arr: TReadableArray<T>, builder: TSorterBuilder<T>) => T[];
733
+ top: <T>(arr: TReadableArray<T>, n: TPositiveNumber, builder: TSorterBuilder<T>) => T[];
734
+ bottom: <T>(arr: TReadableArray<T>, n: TPositiveNumber, builder: TSorterBuilder<T>) => T[];
735
+ first: <T>(arr: TReadableArray<T>, builder: TSorterBuilder<T>) => T | null;
736
+ last: <T>(arr: TReadableArray<T>, builder: TSorterBuilder<T>) => T | null;
737
+ };
738
+
739
+ type TMaybe<T> = T | null;
740
+ declare function ensureDefined<T>(v: T, name?: string): T;
741
+ declare function isDefined<T>(x: T | null | undefined): x is T;
742
+ declare function isNullOrUndefined(x: unknown): x is null | undefined;
743
+ declare function ifDefined<R>(source: TMaybe<R>, callback: TConsumer<R>): void;
744
+ declare function mapDefined<R, S>(source: TMaybe<R>, mapper: TFunction<R, S>): TMaybe<S>;
745
+ declare function ifNullOrUndefined(source: TMaybe<unknown>, callback: TVoidFunction): void;
746
+ declare function throwIfNullOrUndefined(source: TMaybe<unknown>, errorProducer?: TProducer<Error>): void;
747
+
748
+ declare function groupByString<V, K extends TKeysOfType<V, string>>(arr: TReadableArray<V>, field: K): Record<V[K] & string, V[]>;
749
+ declare function groupByNumber<V, K extends TKeysOfType<V, number>>(arr: TReadableArray<V>, field: K): Record<V[K] & number, V[]>;
750
+ declare function groupByBoolean<V, K extends TKeysOfType<V, boolean>>(arr: TReadableArray<V>, field: K): Record<"true" | "false", V[]>;
751
+ declare function groupBySymbol<V, K extends TKeysOfType<V, symbol>>(arr: TReadableArray<V>, field: K): Record<V[K] & symbol, V[]>;
752
+ declare function groupByStringWith<V, K extends string>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<K, V[]>;
753
+ declare function groupByNumberWith<V, K extends number>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<K, V[]>;
754
+ declare function groupByBooleanWith<V, K extends boolean>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<"true" | "false", V[]>;
755
+ declare function groupBySymbolWith<V, K extends symbol>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<K, V[]>;
756
+
757
+ declare function indexByString<V, K extends TKeysOfType<V, string>>(arr: V[], field: K): Record<V[K] & string, V>;
758
+ declare function indexByNumber<V, K extends TKeysOfType<V, number>>(arr: V[], field: K): Record<V[K] & number, V>;
759
+ declare function indexBySymbol<V, K extends TKeysOfType<V, symbol>>(arr: V[], field: K): Record<V[K] & symbol, V>;
760
+ declare function indexByStringWith<V>(arr: V[], getter: TFunction<V, string>): Record<string, V>;
761
+ declare function indexByNumberWith<V>(arr: V[], getter: TFunction<V, number>): Record<number, V>;
762
+ declare function indexBySymbolWith<V>(arr: V[], getter: TFunction<V, symbol>): Record<symbol, V>;
763
+
764
+ declare function average(arr: TReadableArray<number>): number;
765
+ declare function sum(arr: TReadableArray<number>): number;
766
+ declare function sumBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
767
+ declare function min(arr: TReadableArray<number>): number;
768
+ declare function minBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
769
+ declare function max(arr: TReadableArray<number>): number;
770
+ declare function maxBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
771
+
772
+ declare function uniq<T>(arr: T[]): T[];
773
+ declare function uniqBy<T, K>(arr: T[], getter: TFunction<T, K>): T[];
774
+ declare function uniqByKey<T, K extends keyof T>(arr: T[], key: K): T[];
775
+
776
+ type TReadableArray<T> = Array<T> | ReadonlyArray<T>;
777
+ type TArrayable<T> = T | T[];
778
+ type TEmptyArray = [];
779
+ declare function ensureArray<const T>(t: T | Array<T> | null | undefined): Array<T>;
780
+ declare function ensureReadableArray<const T>(t: T | Array<T> | ReadonlyArray<T> | null | undefined): TReadableArray<T>;
781
+ declare function isArray<const T>(t: unknown): t is Array<T>;
782
+ /**
783
+ * Generate a new copy of an array with:
784
+ * - the first instance of an item matching the predicate being replaced with the given argument
785
+ * - the given argument added as last item of the array if the predicate did not produce a match
786
+ * @param arr - the original array of items
787
+ * @param item - the item to insert or update
788
+ * @param predicate - a function that returns true iff an item is equal to the given argument
789
+ * @returns a new copy of the array with the item updated or added in last place
790
+ */
791
+ declare function upsert<T>(arr: ReadonlyArray<T>, item: T, isEqual: TBiPredicate<T>): Array<T>;
792
+ declare function range(start: number, end: number): Array<number>;
793
+ declare function fill<T>(length: number, value: T): Array<T>;
794
+ declare function extendArray<T extends Record<string | number | symbol, unknown>, X extends Record<string | number | symbol, unknown>>(arr: TReadableArray<T>, props: X): Array<(T & X)>;
795
+ declare function extendArrayWith<T extends Record<string | number | symbol, unknown>, X extends Record<string | number | symbol, unknown>>(arr: TReadableArray<T>, propsFn: (t: T) => X): Array<(T & X)>;
796
+ declare function reverse<T>(arr: TReadableArray<T>): Array<T>;
797
+ declare function first<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
798
+ declare function last<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
799
+ declare const head: typeof first;
800
+ declare function tail<T>(arr: TReadableArray<T>): T[];
801
+ declare function sortedArray<T>(arr: Array<T>, sortFn?: TComparisonFunction<T> | undefined): Array<T>;
802
+ declare function sortedArray<T>(arr: ReadonlyArray<T>, sortFn?: TComparisonFunction<T> | undefined): ReadonlyArray<T>;
803
+ /**
804
+ * Custom implementation of includes which allows checking for arbitrary items inside the array.
805
+ */
806
+ declare function arrayIncludes<T>(arr: TReadableArray<T>, item: unknown, fromIndex?: number): boolean;
807
+ /** @deprecated[2025.11.08]: Use {@link arrayIncludes} instead. */
808
+ declare const includes: typeof arrayIncludes;
809
+ declare function mapTruthys<T, R>(arr: Array<T>, mapper: (value: T, index: number, array: T[]) => R | undefined): Array<R>;
810
+ declare function flatMapTruthys<T, R>(arr: Array<T>, mapper: (value: T, index: number, array: T[]) => R | undefined): Array<R>;
811
+ declare function filterMap<T, R>(array: T[], filterFn: TPredicate<T>, mapFn: TTransformer<T, R>): R[];
812
+ declare function filterMapReduce<T, U, R>(array: T[], filterFn: TPredicate<T>, mapFn: TTransformer<T, U>, reduceFn: TAccumulator<R, U>, initialValue: R): R;
813
+ /**
814
+ * Partitions the given array in two groups, in the first one there will be any and only values of the array that match the given predicate, in the second one there will be any and only values that don't.
815
+ * @param arr the array of items
816
+ * @param predicate the predicate to use to partition the array
817
+ * @returns a tuple, where the first array contains items matching the predicate, and the second array contains items not matching the predicate.
818
+ */
819
+ declare function partition<T>(arr: T[], predicate: TPredicate<T>): [T[], T[]];
820
+ /**
821
+ * Maps the first truthy value in the array using the provided mapping function.
822
+ * @param arr - The array of items.
823
+ * @param mapFn - The mapping function.
824
+ * @returns The first truthy value returned by the mapping function, or null if no truthy value is found.
825
+ */
826
+ declare function mapFirstTruthy<T, R>(arr: T[], mapFn: TTransformer<T, R>): R | null;
827
+ declare function listToDict<T, K extends string, V>(arr: T[], mapFn: TTransformer<T, [K, V]>): Record<K, V>;
828
+ declare function shallowArrayEquals(a: unknown[], b: unknown[]): boolean;
829
+ declare function findInArray<T>(arr: T[], predicate: TPredicate<T>): TOptional<T>;
830
+ declare function findIndexInArray<T>(arr: T[], predicate: TPredicate<T>): TOptional<number>;
831
+ declare function zip<T, R>(ts: T[], rs: R[]): [T, R][];
832
+ declare function unzip<T, R>(arr: [T, R][]): [T[], R[]];
833
+ /**
834
+ * Gets the element at the specified index in the array, wrapped in an Optional.
835
+ * Returns an empty Optional if the index is out of bounds (negative or >= array length).
836
+ * @param arr - The array to get the element from
837
+ * @param index - The index of the element to retrieve
838
+ * @returns An Optional containing the element at the index, or empty if index is out of bounds
839
+ */
840
+ declare function arrayGet<T>(arr: TReadableArray<T>, index: number): TEmptyOptional<T> | TPresentOptional<T>;
841
+
842
+ declare function isTrue(x: unknown): x is true;
843
+ declare function isFalse(x: unknown): x is false;
844
+
845
+ declare function dictToEntries<V, K extends string = string>(obj: Record<K, V>): [K, V][];
846
+ declare function entriesToDict<V, K extends string = string>(entries: [K, V][]): Record<K, V>;
847
+ declare function entriesToEntries<K1 extends string, V1, K2 extends string, V2>(dict: Record<K1, V1>, mapper: TFunction<[K1, V1], [K2, V2]>): Record<K2, V2>;
848
+ /** @deprecated[2025.08.01]: Compatibility layer. */
849
+ declare const mapEntries: typeof entriesToEntries;
850
+ declare function entriesToList<K1 extends string, V1, R>(dict: Record<K1, V1>, mapper: TFunction<[K1, V1], R>): Array<R>;
851
+
852
+ type TEmpty = Record<string, never>;
853
+ type TKeysOfType<T, V> = {
854
+ [K in keyof T]-?: T[K] extends V ? K : never;
855
+ }[keyof T];
856
+ declare function dictToList<T>(obj: Record<string | number, T>): T[];
857
+ declare function pick<T extends object, K extends keyof T>(o: T, keys: K[]): Pick<T, K>;
858
+ type TOptionsWithoutDefaults<T, R> = Partial<T> & Required<Omit<T, keyof R>>;
859
+ type TOptionalKeysForType<T> = {
860
+ [K in keyof T]-?: {} extends Pick<T, K> ? K : never;
861
+ }[keyof T];
862
+ type TRequiredKeysForType<T> = Exclude<keyof T, TOptionalKeysForType<T>>;
863
+ type TAllKeysOptional<T> = TRequiredKeysForType<T> extends never ? true : false;
864
+ type TConditionalParameter<T> = TAllKeysOptional<T> extends true ? T | undefined : T;
865
+ type TConditionalParameterOptions<T, R> = TConditionalParameter<TOptionsWithoutDefaults<T, R>>;
866
+ /**
867
+ * Given a type T, replaces all fields of type From to fields of type To.
868
+ */
869
+ type TReplaceType<T, From, To> = {
870
+ [K in keyof T]: T[K] extends From ? To : T[K];
871
+ };
872
+ /**
873
+ * Given a type T, make field K required instead of optional.
874
+ */
875
+ type TWithRequiredProperty<T, K extends keyof T> = T & {
876
+ [Property in K]-?: T[Property];
877
+ };
878
+ /**
879
+ * Given a type T, make all fields required instead of optional.
880
+ */
881
+ type TWithRequiredProperties<T> = Required<T>;
882
+ /**
883
+ * Type that forces a record to contain a few properties, but allows for extraneous properties.
884
+ */
885
+ type TWithExtras<R extends Record<any, any>, T extends Record<any, any> = Record<string, unknown>> = R & T;
886
+ /**
887
+ * Types that improves the human readability of a Typescript type.
888
+ */
889
+ type TPrettify<T> = {
890
+ [K in keyof T]: T[K];
891
+ } & {};
892
+ declare function shallowRecordEquals(a: Record<string, unknown>, b: Record<string, unknown>): boolean;
893
+ /**
894
+ * A utility type that checks if any property in a record type `T` has the `never` type.
895
+ * This type evaluates to `true` if at least one property in `T` is of type `never`, and `false` otherwise.
896
+ * It's commonly used to create compile-time assertions that prevent unintended changes where properties might accidentally become `never` due to type mismatches.
897
+ *
898
+ * @example Advanced usage for type guards
899
+ * ```typescript
900
+ * type TMap = { a: string; b: number; c: boolean };
901
+ * type TJsonSerializable = string | number | boolean;
902
+ *
903
+ * type TFiltered = {
904
+ * [K in keyof TMap]: TMap[K] extends TJsonSerializable ? TMap[K] : never;
905
+ * };
906
+ *
907
+ * // If TMap changes and some property becomes not serializable, TFiltered will have 'never' values
908
+ * const _guard: THasNever<TFiltered> = false; // Compile error if any property became 'never'
909
+ * ```
910
+ */
911
+ type THasNever<T> = {
912
+ [K in keyof T]: [T[K]] extends [never] ? true : false;
913
+ }[keyof T] extends false ? false : true;
914
+
915
+ type TCssRuleDeclarationKey = TKeysOfType<CSSStyleDeclaration, string> & string;
916
+ type TCssVariableDeclarationKey = `--${string}`;
917
+ type TCssGenericDeclarationKey = TCssRuleDeclarationKey | TCssVariableDeclarationKey;
918
+ type TCssDeclarationRulesDictionary = Partial<Record<TCssGenericDeclarationKey, string>>;
919
+ type TCssSelectorDeclarationRulesDictionary = {
920
+ [selector: string]: TCssDeclarationRulesDictionary | TCssSelectorDeclarationRulesDictionary;
921
+ };
922
+ declare function cssDeclarationRulesDictionaryToCss(syleDeclarationRulesForSelectorsProduceable: TProduceable<TCssSelectorDeclarationRulesDictionary>, indent?: number): string;
923
+ declare function transformCssDictionary(dict: TCssSelectorDeclarationRulesDictionary, transformer: (key: TCssGenericDeclarationKey, value: string) => string): TCssSelectorDeclarationRulesDictionary;
924
+ type TProduceable<T> = T | TProducer<T>;
925
+
926
+ /**
927
+ * Define a new type that is true if T is the empty object, false otherwise.
928
+ */
929
+ type TIsEmptyObject<T> = keyof T extends never ? true : false;
930
+ /**
931
+ * Defines a new type that is the empty array, if T is an empty object, or is the array containing T if T is not the empty object.<br/>
932
+ * This type can be used as function argument, to conditionally require an argument based on type T.<br/>
933
+ * Usage example:
934
+ * ```
935
+ * type TMetadata = { a: {}, b: {}, c: { x: 1 } };
936
+ * function foo<X extends keyof TMetadata>( type: X, metadata: TMetadata[X] ) { ... };
937
+ * export function fooWrapper<X extends keyof TMetadata>( type: X, ...args: TConditionalOptionalType<TMetadata[X]> ) {
938
+ * const bar = foo( type, args.length === 0 ? void 0 : args[ 0 ] );
939
+ * }
940
+ * ```
941
+ */
942
+ type TConditionalOptionalType<T> = TIsEmptyObject<T> extends true ? [] : [T];
943
+ type TEmptyObject = Record<string, never>;
944
+
945
+ type TOperation<T, E = Error> = {
946
+ success: false;
947
+ error: E;
948
+ } | {
949
+ success: true;
950
+ data: T;
951
+ };
952
+ type TAsyncOperation<T, E = Error> = Promise<TOperation<T, E>>;
953
+ type TOperationTuple<T, E = Error> = [T, undefined] | [undefined, E];
954
+ type TAsyncOperationTuple<T, E = Error> = Promise<TOperationTuple<T, E>>;
955
+ type TValidation<T, E = Error> = {
956
+ success: false;
957
+ errors: E[];
958
+ } | {
959
+ success: true;
960
+ data: T;
961
+ };
962
+ type TAsyncValidation<T, E = Error> = Promise<TValidation<T, E>>;
963
+ declare const Operation: {
964
+ ok: <const T>(data: T) => {
965
+ readonly success: true;
966
+ readonly data: T;
967
+ };
968
+ ko: <const E>(error: E) => {
969
+ readonly success: false;
970
+ readonly error: E;
971
+ };
972
+ };
973
+
974
+ declare function withTryCatch<R>(fn: TFunction<void, R>, errMapFn?: TTransformer<Error, Error>): TOperationTuple<R, Error>;
975
+ declare function withTryCatchAsync<R>(fn: TFunction<void, Promise<R>>, errMapFn?: TTransformer<Error, Error>): TAsyncOperationTuple<R, Error>;
976
+
977
+ declare function asError(e: unknown): Error;
978
+ declare function isError(e: unknown): e is Error;
979
+ declare function getMessageFromError(error: Error): string;
980
+ declare function getStackFromError(error: Error): string;
981
+ declare function getCauseMessageFromError(error: Error): string;
982
+ declare function getCauseStackFromError(error: Error): string;
983
+ /**
984
+ * Throws an error if a switch discriminated union type does not cover all the expected cases.
985
+ * Expected usage: `
986
+ * switch ( x.type ) {
987
+ * case "x": return doX();
988
+ * case "y": return doY();
989
+ * ...
990
+ * default: throw new NonExhaustiveSwitchError( x satisfies never );
991
+ * }`
992
+ */
993
+ declare class NonExhaustiveSwitchError extends Error {
994
+ constructor(value: unknown);
995
+ }
996
+
997
+ type TJsonPrimitive = string | number | boolean | null | undefined;
998
+ type TJsonArray = Array<TJsonSerializable> | ReadonlyArray<TJsonSerializable>;
999
+ type TJsonObject = {
1000
+ [key: string]: TJsonSerializable;
1001
+ };
1002
+ type TJsonSerializable = TJsonPrimitive | TJsonArray | TJsonObject;
1003
+ declare function tryToParseJson<T extends TJsonSerializable>(jsonContent: string): [T, undefined] | [undefined, Error];
1004
+ declare function parseJson<T extends TJsonSerializable>(jsonContent: string): T;
1005
+ declare function stringifyJson(jsonSerializable: TJsonSerializable, minify?: boolean): string;
1006
+ declare function jsonCloneDeep<A extends TJsonSerializable>(a: A): A;
1007
+ declare function omitFromJsonObject<T extends TJsonObject, K extends keyof T>(o: T, ...keys: K[]): Omit<T, K>;
1008
+
1009
+ type TRoundMode = 'toNearest' | 'toLower' | 'toUpper' | 'towardsZero' | 'awayFromZero';
1010
+ declare function round(n: number, precision?: number, mode?: TRoundMode): number;
1011
+
1012
+ declare const roundToNearest: (n: number, precision?: number) => number;
1013
+ declare const roundToLower: (n: number, precision?: number) => number;
1014
+ declare const roundToUpper: (n: number, precision?: number) => number;
1015
+ declare const roundTowardsZero: (n: number, precision?: number) => number;
1016
+ declare const roundAwayFromZero: (n: number, precision?: number) => number;
1017
+
1018
+ type TNumericString = `${number}`;
1019
+ type TNumericFloatingPointString = `${number}.${number}`;
1020
+ type TPositiveNumber = number;
1021
+ type TNegativeNumber = number;
1022
+ type TZero = 0;
1023
+ type TDigit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
1024
+ type TDigit1_9 = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
1025
+ type TNumber0_100 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100;
1026
+ type TNumber0_1000 = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999;
1027
+ type TNumber0_5 = 0 | 1 | 2 | 3 | 4 | 5;
1028
+ type TNumber0_10 = TNumber0_5 | 6 | 7 | 8 | 9 | 10;
1029
+ type TNumber0_15 = TNumber0_10 | 11 | 12 | 13 | 14 | 15;
1030
+ type TNumber0_20 = TNumber0_15 | 16 | 17 | 18 | 19 | 20;
1031
+ type TNumber1_10 = Exclude<TNumber0_10, 0>;
1032
+ type TParseInt<T> = T extends `${infer N extends number}` ? N : never;
1033
+ type TParseableInt<T> = T extends `${number}` ? T : never;
1034
+ declare function ensurePositiveNumber(v: number, name?: string): number;
1035
+ declare function ensureNonNegativeNumber(v: number, name?: string): number;
1036
+ declare function ensureNonPositiveNumber(v: number, name?: string): number;
1037
+ declare function ensureNegativeNumber(v: number, name?: string): number;
1038
+ declare function incrementBy(n: number): TFunction<number, number>;
1039
+ declare function multiplyBy(n: number): TFunction<number, number>;
1040
+ declare function divideBy(n: number): TFunction<number, number>;
1041
+ declare const increment: TFunction<number, number>;
1042
+ declare const decrement: TFunction<number, number>;
1043
+ declare const decrementBy: (n: number) => TFunction<number, number>;
1044
+ declare function isNumber(v: unknown): v is number;
1045
+ declare function isPositiveNumber(v: number): v is TPositiveNumber;
1046
+ declare function isNegativeNumber(v: number): v is TNegativeNumber;
1047
+ declare function isZero(v: number): v is TZero;
1048
+ declare function clamp(n: number, min: number, max: number): number;
1049
+ declare function clampInt0_100(n: number): TNumber0_100;
1050
+ declare function tryToParseNumber(numberStr: string): TOperationTuple<number, Error>;
1051
+
1052
+ type TTimeoutHandle = ReturnType<typeof setTimeout>;
1053
+ type TIntervalHandle = ReturnType<typeof setInterval>;
1054
+ type TPrimitive = string | number | boolean | null;
1055
+
1056
+ type TPromisable<T> = T | Promise<T>;
1057
+ declare function asPromise<T>(promisable: TPromisable<T>): Promise<T>;
1058
+ declare function promiseSequence<R>(...fns: TFunction<void, Promise<R>>[]): TFunction<void, Promise<R[]>>;
1059
+ declare function delayPromise<T>(duration: TimeDuration): TAsyncFunction<T, T>;
1060
+ declare class TimeoutError extends Error {
1061
+ }
1062
+ declare function awaitAtMost<T>(promise: Promise<T>, duration: TimeDuration): Promise<T>;
1063
+ declare const NEVER: Promise<unknown>;
1064
+
1065
+ declare function randomNumberInInterval(min: number, max: number): number;
1066
+ declare const randomId: (length: TPositiveNumber) => string;
1067
+
1068
+ declare class StringParts {
1069
+ private readonly _parts;
1070
+ private constructor();
1071
+ toUpperCase(): StringParts;
1072
+ toLowerCase(): StringParts;
1073
+ capitalizeFirst(): StringParts;
1074
+ capitalizeEach(): StringParts;
1075
+ get parts(): string[];
1076
+ get tail(): string[];
1077
+ get first(): TMaybe<string>;
1078
+ get last(): TMaybe<string>;
1079
+ get length(): number;
1080
+ trim(): StringParts;
1081
+ toSnakeCase(): string;
1082
+ toCamelCase(): string;
1083
+ toKebabCase(): string;
1084
+ toPascalCase(): string;
1085
+ toHumanCase(): string;
1086
+ join(separator: string): string;
1087
+ mergeWith({ parts: otherParts }: {
1088
+ parts: TReadableArray<string>;
1089
+ }): StringParts;
1090
+ slice(start: number, end?: number): StringParts;
1091
+ splice(start: number, deleteCount: number, ...items: string[]): StringParts;
1092
+ push(part: string): StringParts;
1093
+ shift(part: string): StringParts;
1094
+ reverse(): StringParts;
1095
+ static fromString: (s: string, separator?: string | RegExp) => StringParts;
1096
+ static fromParts: (...parts: string[]) => StringParts;
1097
+ /**
1098
+ * Tries to convert a word in PascalCase to an array of words. Will not work if there are spaces or special characters. Does not cope well on uppercase abbreviations (eg, "CSS").
1099
+ * @param s a string in PascalCase.
1100
+ * @returns a StringParts where each sub-word in PascalCase is now a part.
1101
+ */
1102
+ static tryToParsePascalCaseWord(s: string): StringParts;
1103
+ }
1104
+
1105
+ type THtmlString = string;
1106
+ type TUrl = string;
1107
+ type TRelativeUrl = string;
1108
+ declare function hashCode(str: string): number;
1109
+ declare function repeat(char: string, times: number): string;
1110
+ declare function capitalizeWord(word: string): string;
1111
+ declare function splitWords(text: string, regEx?: RegExp): string[];
1112
+ declare function stringToNumber(s: string | null | undefined): number | null;
1113
+ declare function pad(str: string, n: number, char: string, where?: 'left' | 'right'): string;
1114
+ declare function padLeft(str: string, n: number, char: string): string;
1115
+ declare function padRight(str: string, n: number, char: string): string;
1116
+ declare function ellipsis(str: string, maxLength: number): string;
1117
+ declare function pluralize(n: number, singular: string, plural?: string): string;
1118
+ declare function isString(source: unknown): source is string;
1119
+ declare function isEmpty(source: string): boolean;
1120
+ declare function isNullOrUndefinedOrEmpty(source: TMaybe<string>): boolean;
1121
+ declare function wrapWithString(str: string, delimiter: string): string;
1122
+ declare function wrapWithString(str: string, start: string, end: string): string;
1123
+
1124
+ declare class TimeFrequency {
1125
+ readonly times: TPositiveNumber;
1126
+ readonly period: TimeDuration;
1127
+ constructor(times: TPositiveNumber, period: TimeDuration);
1128
+ get frequency(): TimeDuration;
1129
+ static onceEvery(period: TimeDuration): TimeFrequency;
1130
+ static twiceEvery(period: TimeDuration): TimeFrequency;
1131
+ }
1132
+
1133
+ type TPromiseFactory<T, R> = TFunction<T, Promise<R>>;
1134
+ declare class RateThrottler {
1135
+ private readonly _frequency;
1136
+ private readonly _availableSlots;
1137
+ private readonly _waitingRequests;
1138
+ constructor(_frequency: TimeFrequency);
1139
+ get cooldown(): TimeDuration;
1140
+ execute<T>(fn: TPromiseFactory<void, T>): Promise<T>;
1141
+ }
1142
+
1143
+ declare function throttle<TParams extends unknown[], R>(fn: (...params: TParams) => TPromisable<R>, frequence: TimeFrequency): (...params: TParams) => Promise<R>;
1144
+
1145
+ declare class Semaphore {
1146
+ private _availableSlots;
1147
+ private readonly _queuedRequests;
1148
+ private _inProgress;
1149
+ /** Creates a new Semaphore with a single slot. */
1150
+ constructor();
1151
+ /** Creates a new Semaphore with the specified amounts of slots. */
1152
+ constructor(availableSlots: number);
1153
+ private _awaitSlot;
1154
+ private _releaseSlot;
1155
+ execute<T>(fn: TAsyncProducer<T> | TProducer<T>, cooldown?: TimeDuration): Promise<T>;
1156
+ get availableSlots(): number;
1157
+ get queueSize(): number;
1158
+ get inProgressSize(): number;
1159
+ }
1160
+
1161
+ /**
1162
+ * Class that stores a value that is computationally/memory intensive to initialize.
1163
+ * The initialization of the value is done once and only if required (lazy initialization).
1164
+ * @author gtomberli
1165
+ */
1166
+ declare class Lazy<T> {
1167
+ private _value;
1168
+ private _initialized;
1169
+ private _generator;
1170
+ private constructor();
1171
+ get value(): T | undefined;
1172
+ getOrCreate(): T;
1173
+ getOrThrow(errorMessage?: "Value not initialized"): T;
1174
+ or(t: T): T;
1175
+ isPresent(): boolean;
1176
+ isEmpty(): boolean;
1177
+ ifPresent(fn: (t: T) => void): void;
1178
+ ifEmpty(fn: () => void): void;
1179
+ apply(fnPresent: (t: T) => void, fnEmpty: () => void): void;
1180
+ static of<T>(generator: () => T): Lazy<T>;
1181
+ }
1182
+
1183
+ declare class LazyAsync<T> {
1184
+ private _promise;
1185
+ private _pending;
1186
+ private _resolvedValue;
1187
+ private _error;
1188
+ private _generator;
1189
+ private constructor();
1190
+ getOrCreate(): Promise<T>;
1191
+ isPresent(): boolean;
1192
+ isEmpty(): boolean;
1193
+ isPending(): boolean;
1194
+ isReady(): boolean;
1195
+ isResolved(): boolean;
1196
+ isError(): boolean;
1197
+ ifPresent(fn: (t: Promise<T>) => void): void;
1198
+ ifEmpty(fn: () => void): void;
1199
+ ifPending(fn: (t: Promise<T>) => void): void;
1200
+ ifReady(fn: (t: Promise<T>) => void): void;
1201
+ ifResolved(fn: (t: T) => void): void;
1202
+ ifError(fn: (err: Error) => void): void;
1203
+ getOrThrow(errorMessage?: "Value not initialized"): Promise<T> | never;
1204
+ static of<T>(generator: () => Promise<T>): LazyAsync<T>;
1205
+ }
1206
+
1207
+ declare class LazyDictionary<K extends string | number | symbol, T> {
1208
+ private readonly _generator;
1209
+ private readonly _dictionary;
1210
+ private constructor();
1211
+ static of<K extends string | number | symbol, T>(generator: TFunction<K, T>): LazyDictionary<K, T>;
1212
+ getOrCreate(key: K): T;
1213
+ getOrThrow(key: K, errorMessage?: "Value not initialized"): T;
1214
+ }
1215
+
1216
+ declare const LEVELS: readonly ["trace", "log", "debug", "info", "warn", "error"];
1217
+ type TLogLevel = keyof Console & typeof LEVELS[number];
1218
+ type TLoggerOpts = {
1219
+ console: Console;
1220
+ enabled: boolean;
1221
+ minLevel: Uppercase<TLogLevel>;
1222
+ };
1223
+ declare class Logger {
1224
+ readonly name: string;
1225
+ private enabled;
1226
+ private console;
1227
+ private minLevel;
1228
+ constructor(name: string, args?: Partial<TLoggerOpts>);
1229
+ get trace(): (...args: any[]) => void;
1230
+ get log(): (...args: any[]) => void;
1231
+ get debug(): (...args: any[]) => void;
1232
+ get info(): (...args: any[]) => void;
1233
+ get warn(): (...args: any[]) => void;
1234
+ get error(): (...args: any[]) => void;
1235
+ private logWrap;
1236
+ }
1237
+
1238
+ declare class RandomTimeDuration {
1239
+ private constructor();
1240
+ static ms: (a: number, b: number) => TimeDuration;
1241
+ static seconds: (a: number, b: number) => TimeDuration;
1242
+ static minutes: (a: number, b: number) => TimeDuration;
1243
+ static hours: (a: number, b: number) => TimeDuration;
1244
+ static days: (a: number, b: number) => TimeDuration;
1245
+ }
1246
+
1247
+ declare class TimeRange {
1248
+ readonly start: TimeInstant;
1249
+ readonly duration: TimeDuration;
1250
+ readonly end: TimeInstant;
1251
+ protected constructor(start: TimeInstant, duration: TimeDuration);
1252
+ static fromInstants(a: TimeInstant, b: TimeInstant): TimeRange;
1253
+ static fromInstantWithDuration(a: TimeInstant, d: TimeDuration): TimeRange;
1254
+ static fromNowWithDuration(d: TimeDuration): TimeRange;
1255
+ }
1256
+
1257
+ declare class UnavailableUpgradeError<T> extends Error {
1258
+ readonly data: T;
1259
+ readonly from: number;
1260
+ readonly to: number;
1261
+ constructor(data: T, from: number, to: number);
1262
+ }
1263
+ declare class EmptyUpgradeError<T> extends Error {
1264
+ readonly data: T;
1265
+ readonly from: number;
1266
+ readonly to: number;
1267
+ constructor(data: T, from: number, to: number);
1268
+ }
1269
+
1270
+ type TUpgradable = TJsonObject & {
1271
+ $version: number;
1272
+ };
1273
+ type TUpgradableAtVersion<XStar extends TUpgradable, N extends XStar["$version"]> = Extract<XStar, {
1274
+ $version: N;
1275
+ }>;
1276
+ type TVersionMap<XStar extends TUpgradable> = {
1277
+ [XVersionNumber in XStar["$version"]]: TUpgradableAtVersion<XStar, XVersionNumber>;
1278
+ };
1279
+ type TPossibleVersion<XStar extends TUpgradable> = XStar["$version"] & number;
1280
+ type TPossibleFromVersion<XStar extends TUpgradable, XLatest extends XStar> = Exclude<TPossibleVersion<XStar>, XLatest["$version"]>;
1281
+ type TUpgradeFunction<XStar extends TUpgradable, XFrom extends XStar, XTo extends XStar> = TFunction<Readonly<TVersionMap<XStar>[XFrom["$version"]]>, TPromisable<TVersionMap<XStar>[XTo["$version"]]>>;
1282
+
1283
+ declare const VERSION_FIELD = "$version";
1284
+ interface IDataUpgrader<XStar extends TUpgradable, XLatest extends XStar> {
1285
+ upgrade(data: XStar): Promise<XLatest>;
1286
+ }
1287
+ declare class DataUpgrader<X extends TUpgradable, XLatest extends X> implements IDataUpgrader<X, XLatest> {
1288
+ private latestVersion;
1289
+ private transitions;
1290
+ private constructor();
1291
+ addTransition<XFrom extends TVersionMap<X>[XFromNumber], XTo extends TVersionMap<X>[XToNumber], XFromNumber extends TPossibleFromVersion<X, XLatest>, XToNumber extends Exclude<TPossibleVersion<X>, XFromNumber>>(from: XFromNumber, to: XToNumber, apply: TUpgradeFunction<X, XFrom, XTo>): this;
1292
+ upgrade(data: X): Promise<XLatest>;
1293
+ isLatestVersion(data: X): data is XLatest;
1294
+ static create<X extends TUpgradable, XLatestVersion extends X>(latest: XLatestVersion[typeof VERSION_FIELD]): DataUpgrader<X, XLatestVersion>;
1295
+ static Errors: {
1296
+ readonly EmptyUpgrade: typeof EmptyUpgradeError;
1297
+ readonly UnavailableUpgrade: typeof UnavailableUpgradeError;
1298
+ };
1299
+ }
1300
+ declare function isUpgradable(obj: TJsonSerializable): obj is TUpgradable;
1301
+
1302
+ export { DataUpgrader, Deferred, DeferredCanceledError, ErrorCannotInstantiatePresentOptionalWithEmptyValue, ErrorGetEmptyOptional, ErrorSetEmptyOptional, Lazy, LazyAsync, LazyDictionary, Logger, NEVER, NonExhaustiveSwitchError, Operation, Optional, PredicateBuilder, RandomTimeDuration, RateThrottler, Semaphore, Sorter, StringParts, TimeDuration, TimeFrequency, TimeInstant, TimeRange, TimeUnit, TimeoutError, alwaysFalse, alwaysTrue, and, arrayGet, arrayIncludes, asError, asPromise, average, awaitAtMost, capitalizeWord, clamp, clampInt0_100, constant, constantFalse, constantNull, constantOne, constantTrue, constantUndefined, constantZero, cssDeclarationRulesDictionaryToCss, decrement, decrementBy, delayPromise, dictToEntries, dictToList, divideBy, ellipsis, ensureArray, ensureDefined, ensureNegativeNumber, ensureNonNegativeNumber, ensureNonPositiveNumber, ensurePositiveNumber, ensureReadableArray, entriesToDict, entriesToEntries, entriesToList, extendArray, extendArrayWith, fill, filterMap, filterMapReduce, filterWithTypePredicate, findInArray, findIndexInArray, first, flatMapTruthys, getCauseMessageFromError, getCauseStackFromError, getMessageFromError, getStackFromError, groupByBoolean, groupByBooleanWith, groupByNumber, groupByNumberWith, groupByString, groupByStringWith, groupBySymbol, groupBySymbolWith, hashCode, head, identity, ifDefined, ifNullOrUndefined, iff, includes, increment, incrementBy, indexByNumber, indexByNumberWith, indexByString, indexByStringWith, indexBySymbol, indexBySymbolWith, isAllowedTimeDuration, isArray, isDefined, isEmpty, isError, isFalse, isFunction, isNegativeNumber, isNullOrUndefined, isNullOrUndefinedOrEmpty, isNumber, isPositiveNumber, isString, isTimeInstant, isTrue, isUpgradable, isZero, jsonCloneDeep, last, listToDict, mapDefined, mapEntries, mapFirstTruthy, mapTruthys, max, maxBy, min, minBy, multiplyBy, noop, not, omitFromJsonObject, or, pad, padLeft, padRight, parseJson, partition, pick, pipedInvoke, pipedInvokeFromArray, pluralize, promiseSequence, randomId, randomNumberInInterval, range, repeat, reverse, round, roundAwayFromZero, roundToLower, roundToNearest, roundToUpper, roundTowardsZero, shallowArrayEquals, shallowRecordEquals, sortedArray, splitWords, stringToNumber, stringifyJson, sum, sumBy, tail, throttle, throwIfNullOrUndefined, transformCssDictionary, tryToParseJson, tryToParseNumber, uniq, uniqBy, uniqByKey, unzip, upsert, withTryCatch, withTryCatchAsync, wrapWithString, xor, zip };
1303
+ export type { ICancelable, ICancelablePromise, IDataUpgrader, TAccumulator, TAllKeysOptional, TAnyFunction, TArrayable, TAsyncAnyFunction, TAsyncBiConsumer, TAsyncBiFunction, TAsyncBiPredicate, TAsyncConsumer, TAsyncFunction, TAsyncOperation, TAsyncOperationTuple, TAsyncPredicate, TAsyncProducer, TAsyncValidation, TAsyncVoidFunction, TBiConsumer, TBiFunction, TBiPredicate, TComparisonDirection, TComparisonFunction, TComparisonResult, TConditionalOptionalType, TConditionalParameter, TConditionalParameterOptions, TConsumer, TCssDeclarationRulesDictionary, TCssSelectorDeclarationRulesDictionary, TDayOfMonth, TDayOfWeek, TDigit, TDigit1_9, TEmpty, TEmptyArray, TEmptyObject, TEmptyOptional, TFourDigits, TFourDigitsMillisecond, TFourDigitsYear, TFunction, THasNever, THourOfDay, THtmlString, TIdentityFunction, TIntervalHandle, TIsEmptyObject, TIso8601DateString, TIso8601DateUtcString, TJsonArray, TJsonObject, TJsonPrimitive, TJsonSerializable, TKeysOfType, TLoggerOpts, TMaybe, TMillisecondOfSecond, TMinuteOfHour, TMonth, TMonthName, TNegativeNumber, TNumber0_10, TNumber0_100, TNumber0_1000, TNumber0_15, TNumber0_20, TNumber0_5, TNumber1_10, TNumericFloatingPointString, TNumericString, TOneDigit, TOperation, TOperationTuple, TOptional, TOptionalKeysForType, TOptionsWithoutDefaults, TParseInt, TParseableInt, TPositiveNumber, TPredefinedTimeDuration, TPredicate, TPresentOptional, TPrettify, TPrimitive, TProducer, TPromisable, TReadableArray, TRelativeUrl, TReplaceType, TRequiredKeysForType, TSecondOfMinute, TSorter, TSorterBuilder, TStrictComparisonResult, TThreeDigits, TThreeDigitsMillisecond, TTimeInUnits, TTimeoutHandle, TTransformer, TTwoDigits, TTwoDigitsDate, TTwoDigitsHour, TTwoDigitsMinute, TTwoDigitsMonth, TTwoDigitsSecond, TTypePredicate, TUpToFourDigits, TUpToThreeDigits, TUpToTwoDigits, TUpgradable, TUrl, TValidTimeDuration, TValidation, TVoidFunction, TWeekNumber, TWithExtras, TWithRequiredProperties, TWithRequiredProperty, TYear, TZero };