@zelgadis87/utils-core 4.6.0 → 4.6.2
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/dist/Logger.d.ts +21 -0
- package/dist/Optional.d.ts +70 -0
- package/dist/async/CancelableDeferred.d.ts +17 -0
- package/dist/async/Deferred.d.ts +34 -0
- package/dist/async/RateThrottler.d.ts +13 -0
- package/dist/async/Semaphore.d.ts +17 -0
- package/dist/async/index.d.ts +4 -0
- package/dist/index.d.ts +8 -0
- package/dist/lazy/Lazy.d.ts +22 -0
- package/dist/lazy/LazyAsync.d.ts +24 -0
- package/dist/lazy/index.d.ts +2 -0
- package/dist/sorting/ComparisonChain.d.ts +57 -0
- package/dist/sorting/Sorter.d.ts +100 -0
- package/dist/sorting/index.d.ts +4 -0
- package/dist/sorting/types.d.ts +5 -0
- package/dist/time/RandomTimeDuration.d.ts +9 -0
- package/dist/time/TimeBase.d.ts +38 -0
- package/dist/time/TimeDuration.d.ts +81 -0
- package/dist/time/TimeFrequency.d.ts +10 -0
- package/dist/time/TimeInstant.d.ts +175 -0
- package/dist/time/TimeInstantBuilder.d.ts +77 -0
- package/dist/time/TimeRange.d.ts +11 -0
- package/dist/time/TimeUnit.d.ts +17 -0
- package/dist/time/index.d.ts +7 -0
- package/dist/time/types.d.ts +26 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/upgrade/DataUpgrader.d.ts +22 -0
- package/dist/upgrade/errors.d.ts +12 -0
- package/dist/upgrade/getTransitionsPath.d.ts +3 -0
- package/dist/upgrade/index.d.ts +2 -0
- package/dist/upgrade/types.d.ts +31 -0
- package/dist/utils/arrays/groupBy.d.ts +9 -0
- package/dist/utils/arrays/indexBy.d.ts +7 -0
- package/dist/utils/arrays/statistics.d.ts +8 -0
- package/dist/utils/arrays/uniqBy.d.ts +4 -0
- package/dist/utils/arrays.d.ts +57 -0
- package/dist/utils/booleans.d.ts +2 -0
- package/dist/utils/empties.d.ts +17 -0
- package/dist/utils/errors/withTryCatch.d.ts +3 -0
- package/dist/utils/errors.d.ts +3 -0
- package/dist/utils/functions/constant.d.ts +10 -0
- package/dist/utils/functions/iff.d.ts +8 -0
- package/dist/utils/functions.d.ts +31 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/json.d.ts +11 -0
- package/dist/utils/nulls.d.ts +8 -0
- package/dist/utils/numbers/round.d.ts +8 -0
- package/dist/utils/numbers.d.ts +34 -0
- package/dist/utils/primitives.d.ts +3 -0
- package/dist/utils/promises.d.ts +6 -0
- package/dist/utils/random.d.ts +7 -0
- package/dist/utils/records/entries.d.ts +4 -0
- package/dist/utils/records.d.ts +31 -0
- package/dist/utils/strings/StringParts.d.ts +32 -0
- package/dist/utils/strings.d.ts +17 -0
- package/esbuild/index.cjs +222 -93
- package/esbuild/index.cjs.map +7 -0
- package/esbuild/{index.js → index.mjs} +232 -90
- package/esbuild/index.mjs.map +7 -0
- package/package.json +3 -3
- package/esbuild/package.json +0 -39
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { ICancelable, ICancelablePromise } from "../async/Deferred.js";
|
|
2
|
+
import { TComparisonResult } from "../sorting/index.js";
|
|
3
|
+
import TimeBase from "./TimeBase";
|
|
4
|
+
import TimeDuration from "./TimeDuration";
|
|
5
|
+
import { TTimeInstantBuilder, TTimeInstantCreationParameters } from "./TimeInstantBuilder.js";
|
|
6
|
+
import TimeUnit from "./TimeUnit";
|
|
7
|
+
import { TDayOfMonth, TDayOfWeek, TIso8601DateString, TIso8601DateUtcString, TMonth, TWeekNumber } from "./types";
|
|
8
|
+
export declare class TimeInstant extends TimeBase<TimeInstant> {
|
|
9
|
+
protected constructor(number: number, unit: TimeUnit);
|
|
10
|
+
protected create(value: number, unit: TimeUnit): TimeInstant;
|
|
11
|
+
addDuration(duration: TimeDuration): TimeInstant;
|
|
12
|
+
removeDuration(duration: TimeDuration): TimeInstant;
|
|
13
|
+
distanceFrom(instant: TimeInstant): TimeDuration;
|
|
14
|
+
distanceFromNow(): TimeDuration;
|
|
15
|
+
timeLeftFrom(instant: TimeInstant): TimeDuration;
|
|
16
|
+
timeLeftFromNow(): TimeDuration;
|
|
17
|
+
distanceFromStartOfDay(): TimeDuration;
|
|
18
|
+
atStartOfDay(): TimeInstant;
|
|
19
|
+
distanceFromEndOfDay(): TimeDuration;
|
|
20
|
+
atEndOfDay(): TimeInstant;
|
|
21
|
+
promise(): Promise<void>;
|
|
22
|
+
cancelablePromise(): ICancelablePromise<void>;
|
|
23
|
+
delay(cb: () => unknown): void;
|
|
24
|
+
cancelableDelay(cb: () => unknown): ICancelable;
|
|
25
|
+
ensureInTheFuture(): void;
|
|
26
|
+
ensureInThePast(): void;
|
|
27
|
+
isToday(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* @returns the time as HH:mm:ss
|
|
30
|
+
* @deprecated [2024-12-11] this method is too ambigous and should be removed.
|
|
31
|
+
*/
|
|
32
|
+
asTimeString(): string;
|
|
33
|
+
/**
|
|
34
|
+
* @returns the date as dd/MM/yyyy
|
|
35
|
+
* @deprecated [2024-12-11] this method is too ambigous and should be removed.
|
|
36
|
+
*/
|
|
37
|
+
asDateString(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Formats this instant using the given pattern. The pattern can contain the following tokens:
|
|
40
|
+
*
|
|
41
|
+
* | Token | Description | Example |
|
|
42
|
+
* |:------|:--------------------------------|:------------------------------|
|
|
43
|
+
* | D | Weekday, 1 letter | W |
|
|
44
|
+
* | DD | Weekday, 3 letters | Wed |
|
|
45
|
+
* | DDD | Weekday, long | Wednesday |
|
|
46
|
+
* | d | Day of the month, no padding | 3 |
|
|
47
|
+
* | dd | Day of the month, padded to 2 | 03 |
|
|
48
|
+
* | M | Month, numeric | 3 |
|
|
49
|
+
* | MM | Month, 2 digits | 03 |
|
|
50
|
+
* | MMM | Month, 3 letters | Mar |
|
|
51
|
+
* | MMMM | Month, long | March |
|
|
52
|
+
* | y | Year, numeric | 2021 |
|
|
53
|
+
* | yy | Year, 2 digits | 21 |
|
|
54
|
+
* | yyyy | Year, numeric | 2021 |
|
|
55
|
+
* | h | Hours, no padding | 6 |
|
|
56
|
+
* | hh | Hours, padded to 2 | 06 |
|
|
57
|
+
* | H | Hours in 24-format, no padding | 18 |
|
|
58
|
+
* | HH | Hours in 24-format, padded to 2 | 18 |
|
|
59
|
+
* | m | Minutes, no padding | 7 |
|
|
60
|
+
* | m | Minutes, padded to 2 | 07 |
|
|
61
|
+
* | s | Seconds, no padding | 8 |
|
|
62
|
+
* | ss | Seconds, padded to 2 | 08 |
|
|
63
|
+
* | S | Milliseconds, no padding | 9 |
|
|
64
|
+
* | SS | Milliseconds, padded to 2 | 09 |
|
|
65
|
+
* | SSS | Milliseconds, padded to 3 | 009 |
|
|
66
|
+
* | G | Era, narrow | A |
|
|
67
|
+
* | GG | Era, short | AD |
|
|
68
|
+
* | GGG | Era, long | Anno Domino |
|
|
69
|
+
* | Z | Time zone, short | GMT+1 |
|
|
70
|
+
* | ZZ | Time short, long C | entral European Standard Time |
|
|
71
|
+
* | P | Period of the day, narrow | in the morning |
|
|
72
|
+
* | PP | Period of the day, short | in the morning |
|
|
73
|
+
* | PPP | Period of the day, long | in the morning |
|
|
74
|
+
* | a | Meridiem | pm |
|
|
75
|
+
* @param pattern The pattern to use. Refer to the token table above for details.
|
|
76
|
+
* @param config An optional locale and timeZone definition to use during the format.
|
|
77
|
+
* @returns a string, formatted using the given pattern, at the given timeZone with the given locale.
|
|
78
|
+
*/
|
|
79
|
+
format(pattern: string, config?: {
|
|
80
|
+
locale?: string;
|
|
81
|
+
timeZone?: string;
|
|
82
|
+
}): string;
|
|
83
|
+
/**
|
|
84
|
+
* @returns this instant, in ISO 8601 format (eg, 2024-11-01T15:49:22.024Z). The format is meant to always be realiable.
|
|
85
|
+
*/
|
|
86
|
+
asIso8601(): TIso8601DateUtcString;
|
|
87
|
+
/**
|
|
88
|
+
* @returns this instant, in a human readable format. The format COULD change in the future, do NOT use this method for consistent outputs.
|
|
89
|
+
* @deprecated [2024-12-11] this method is too broad and ambigous and should be removed.
|
|
90
|
+
*/
|
|
91
|
+
asHumanTimestamp(): string;
|
|
92
|
+
toUnixTimestamp(): number;
|
|
93
|
+
toDate(): Date;
|
|
94
|
+
toDateUTC(): Date;
|
|
95
|
+
get isInThePast(): boolean;
|
|
96
|
+
get isInTheFuture(): boolean;
|
|
97
|
+
isAfter(other: TimeInstant): boolean;
|
|
98
|
+
isBefore(other: TimeInstant): boolean;
|
|
99
|
+
compareTo(other: TimeInstant): TComparisonResult;
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated: Use {@link distanceFromNow} instead
|
|
102
|
+
*/
|
|
103
|
+
fromNow(): TimeDuration;
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated: Use {@link distanceFrom} instead
|
|
106
|
+
*/
|
|
107
|
+
from(instant: TimeInstant): TimeDuration;
|
|
108
|
+
/**
|
|
109
|
+
* @deprecated: Use {@link distanceFromUnixTimestamp} instead
|
|
110
|
+
*/
|
|
111
|
+
fromTimestamp(timestamp: number): TimeDuration;
|
|
112
|
+
distanceFromUnixTimestamp(timestamp: number): TimeDuration;
|
|
113
|
+
atTime(parameters: Partial<TTimeInstantCreationParameters & {
|
|
114
|
+
year: never;
|
|
115
|
+
month: never;
|
|
116
|
+
date: never;
|
|
117
|
+
}>): TimeInstant;
|
|
118
|
+
atDate(parameters: Partial<TTimeInstantCreationParameters & {
|
|
119
|
+
hours: never;
|
|
120
|
+
minutes: never;
|
|
121
|
+
seconds: never;
|
|
122
|
+
milliseconds: never;
|
|
123
|
+
}>): TimeInstant;
|
|
124
|
+
at(parameters: Partial<TTimeInstantCreationParameters>): TimeInstant;
|
|
125
|
+
isBetween(start: TimeInstant, end: TimeInstant): boolean;
|
|
126
|
+
static fromDate(date: Date): TimeInstant;
|
|
127
|
+
static fromUnixTimestamp(unixTimestamp: number): TimeInstant;
|
|
128
|
+
static fromUnixSeconds(unixSeconds: number): TimeInstant;
|
|
129
|
+
static fromParameters(parameters: Partial<TTimeInstantCreationParameters>, referenceDate?: Date | TimeInstant): TimeInstant;
|
|
130
|
+
static highest(instant1: TimeInstant, instant2: TimeInstant): TimeInstant;
|
|
131
|
+
static lowest(instant1: TimeInstant, instant2: TimeInstant): TimeInstant;
|
|
132
|
+
static builder(): TTimeInstantBuilder;
|
|
133
|
+
/**
|
|
134
|
+
* @deprecated[19/07/2023] Use {@link fromParameters} instead.
|
|
135
|
+
*/
|
|
136
|
+
static fromUnits({ date, month, year, hours, minutes, seconds }: {
|
|
137
|
+
date: number;
|
|
138
|
+
month: number;
|
|
139
|
+
year: number;
|
|
140
|
+
hours?: number;
|
|
141
|
+
minutes?: number;
|
|
142
|
+
seconds?: number;
|
|
143
|
+
}): TimeInstant;
|
|
144
|
+
static fromIso8601(str: TIso8601DateString): TimeInstant;
|
|
145
|
+
static tryFromIso8601(str: string): TimeInstant;
|
|
146
|
+
static now(): TimeInstant;
|
|
147
|
+
static get currentTimeStamp(): number;
|
|
148
|
+
static compare(a: TimeInstant, b: TimeInstant): TComparisonResult;
|
|
149
|
+
roundedToStartOf(unit: TimeUnit): TimeInstant;
|
|
150
|
+
roundedToEndOf(unit: TimeUnit): TimeInstant;
|
|
151
|
+
roundedToNext(unit: TimeUnit, factor?: number): TimeInstant;
|
|
152
|
+
roundedToPrevious(unit: TimeUnit, factor?: number): TimeInstant;
|
|
153
|
+
roundedTo(unit: TimeUnit, factor?: number): TimeInstant;
|
|
154
|
+
get dayOfMonth(): TDayOfMonth;
|
|
155
|
+
get dayOfWeek(): TDayOfWeek;
|
|
156
|
+
get month(): TMonth;
|
|
157
|
+
get year(): number;
|
|
158
|
+
/**
|
|
159
|
+
* Returns the week number represented by this instant, according to the ISO 8601 standard.
|
|
160
|
+
* 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.
|
|
161
|
+
*/
|
|
162
|
+
get weekNumber(): {
|
|
163
|
+
weekNumber: TWeekNumber;
|
|
164
|
+
year: number;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* This method is used to provide a better DX when inspecting a TimeInstant object in DevTools.
|
|
168
|
+
*/
|
|
169
|
+
protected get _time(): string;
|
|
170
|
+
toString(): string;
|
|
171
|
+
static ZERO: TimeInstant;
|
|
172
|
+
static fromJSON(ms: number): TimeInstant;
|
|
173
|
+
}
|
|
174
|
+
export declare function isTimeInstant(x: unknown): x is TimeInstant;
|
|
175
|
+
export default TimeInstant;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { TimeInstant } from "./TimeInstant.js";
|
|
2
|
+
import { TDayOfMonth, THourOfDay, TMillisecondOfSecond, TMinuteOfHour, TMonth, TSecondOfMinute, TUpToTwoDigits } from "./types.js";
|
|
3
|
+
type TRelativeSignum = '+' | '-';
|
|
4
|
+
type TRelativeNumber = `${TRelativeSignum}${TUpToTwoDigits}`;
|
|
5
|
+
export type TTimeInstantCreationParameters = {
|
|
6
|
+
year: number | {
|
|
7
|
+
absolute: number;
|
|
8
|
+
} | TRelativeNumber | {
|
|
9
|
+
relative: number;
|
|
10
|
+
relativeTo: 'now' | TimeInstant;
|
|
11
|
+
} | 'next' | 'last' | 'current' | undefined;
|
|
12
|
+
month: TMonth | {
|
|
13
|
+
absolute: TMonth;
|
|
14
|
+
} | keyof typeof monthNames | TRelativeNumber | {
|
|
15
|
+
relative: number;
|
|
16
|
+
relativeTo: 'now' | TimeInstant;
|
|
17
|
+
} | 'next' | 'last' | 'current' | undefined;
|
|
18
|
+
date: TDayOfMonth | {
|
|
19
|
+
absolute: TDayOfMonth;
|
|
20
|
+
} | TRelativeNumber | {
|
|
21
|
+
relative: number;
|
|
22
|
+
relativeTo: 'now' | TimeInstant;
|
|
23
|
+
} | 'next' | 'last' | 'current' | undefined;
|
|
24
|
+
hours: THourOfDay | {
|
|
25
|
+
absolute: THourOfDay;
|
|
26
|
+
} | TRelativeNumber | {
|
|
27
|
+
relative: number;
|
|
28
|
+
relativeTo: 'now' | TimeInstant;
|
|
29
|
+
} | 'next' | 'last' | 'current' | undefined;
|
|
30
|
+
minutes: TMinuteOfHour | {
|
|
31
|
+
absolute: TMinuteOfHour;
|
|
32
|
+
} | TRelativeNumber | {
|
|
33
|
+
relative: number;
|
|
34
|
+
relativeTo: 'now' | TimeInstant;
|
|
35
|
+
} | 'next' | 'last' | 'current' | undefined;
|
|
36
|
+
seconds: TSecondOfMinute | {
|
|
37
|
+
absolute: TSecondOfMinute;
|
|
38
|
+
} | TRelativeNumber | {
|
|
39
|
+
relative: number;
|
|
40
|
+
relativeTo: 'now' | TimeInstant;
|
|
41
|
+
} | 'next' | 'last' | 'current' | undefined;
|
|
42
|
+
milliseconds: TMillisecondOfSecond | {
|
|
43
|
+
absolute: TMillisecondOfSecond;
|
|
44
|
+
} | TRelativeNumber | {
|
|
45
|
+
relative: number;
|
|
46
|
+
relativeTo: 'now' | TimeInstant;
|
|
47
|
+
} | 'next' | 'last' | 'current' | undefined;
|
|
48
|
+
};
|
|
49
|
+
declare const monthNames: {
|
|
50
|
+
readonly january: 1;
|
|
51
|
+
readonly february: 2;
|
|
52
|
+
readonly march: 3;
|
|
53
|
+
readonly april: 4;
|
|
54
|
+
readonly may: 5;
|
|
55
|
+
readonly june: 6;
|
|
56
|
+
readonly july: 7;
|
|
57
|
+
readonly august: 8;
|
|
58
|
+
readonly september: 9;
|
|
59
|
+
readonly october: 10;
|
|
60
|
+
readonly november: 11;
|
|
61
|
+
readonly december: 12;
|
|
62
|
+
};
|
|
63
|
+
export declare function createTimeInstantFromParameters(aParameters: Partial<TTimeInstantCreationParameters>, aReferenceDate?: TimeInstant | Date): TimeInstant;
|
|
64
|
+
export declare function timeInstantBuilder(): {
|
|
65
|
+
year: (x: TTimeInstantCreationParameters["year"]) => /*elided*/ any;
|
|
66
|
+
month: (x: TTimeInstantCreationParameters["month"]) => /*elided*/ any;
|
|
67
|
+
date: (x: TTimeInstantCreationParameters["date"]) => /*elided*/ any;
|
|
68
|
+
hours: (x: TTimeInstantCreationParameters["hours"]) => /*elided*/ any;
|
|
69
|
+
minutes: (x: TTimeInstantCreationParameters["minutes"]) => /*elided*/ any;
|
|
70
|
+
seconds: (x: TTimeInstantCreationParameters["seconds"]) => /*elided*/ any;
|
|
71
|
+
milliseconds: (x: TTimeInstantCreationParameters["milliseconds"]) => /*elided*/ any;
|
|
72
|
+
values: (x: Partial<TTimeInstantCreationParameters>) => /*elided*/ any;
|
|
73
|
+
relativeTo: (x: TimeInstant | Date) => /*elided*/ any;
|
|
74
|
+
build: () => TimeInstant;
|
|
75
|
+
};
|
|
76
|
+
export type TTimeInstantBuilder = ReturnType<typeof timeInstantBuilder>;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TimeDuration } from "./index.js";
|
|
2
|
+
import TimeInstant from "./TimeInstant.js";
|
|
3
|
+
export declare class TimeRange {
|
|
4
|
+
readonly start: TimeInstant;
|
|
5
|
+
readonly duration: TimeDuration;
|
|
6
|
+
readonly end: TimeInstant;
|
|
7
|
+
protected constructor(start: TimeInstant, duration: TimeDuration);
|
|
8
|
+
static fromInstants(a: TimeInstant, b: TimeInstant): TimeRange;
|
|
9
|
+
static fromInstantWithDuration(a: TimeInstant, d: TimeDuration): TimeRange;
|
|
10
|
+
static fromNowWithDuration(d: TimeDuration): TimeRange;
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default class TimeUnit {
|
|
2
|
+
readonly multiplier: number;
|
|
3
|
+
private constructor();
|
|
4
|
+
toUnit(value: number, unit: TimeUnit): number;
|
|
5
|
+
toMs(value: number): number;
|
|
6
|
+
toSeconds(value: number): number;
|
|
7
|
+
toMinutes(value: number): number;
|
|
8
|
+
toHours(value: number): number;
|
|
9
|
+
toDays(value: number): number;
|
|
10
|
+
toWeeks(value: number): number;
|
|
11
|
+
static readonly MILLISECONDS: TimeUnit;
|
|
12
|
+
static readonly SECONDS: TimeUnit;
|
|
13
|
+
static readonly MINUTES: TimeUnit;
|
|
14
|
+
static readonly HOURS: TimeUnit;
|
|
15
|
+
static readonly DAYS: TimeUnit;
|
|
16
|
+
static readonly WEEKS: TimeUnit;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as RandomTimeDuration } from './RandomTimeDuration';
|
|
2
|
+
export { TPredefinedTimeDuration, TValidTimeDuration, TimeDuration, isAllowedTimeDuration } from './TimeDuration';
|
|
3
|
+
export { default as TimeFrequency } from './TimeFrequency';
|
|
4
|
+
export * from './TimeInstant';
|
|
5
|
+
export * from './TimeRange.js';
|
|
6
|
+
export { default as TimeUnit } from './TimeUnit';
|
|
7
|
+
export * from './types';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TDigit, TDigit1_9, TNumber0_1000, TParseableInt } from "../utils";
|
|
2
|
+
export type TOneDigit = `${TDigit}`;
|
|
3
|
+
export type TTwoDigits = `${TDigit}${TDigit}`;
|
|
4
|
+
export type TThreeDigits = `${TDigit}${TDigit}${TDigit}`;
|
|
5
|
+
export type TFourDigits = `${TDigit}${TDigit}${TDigit}${TDigit}`;
|
|
6
|
+
export type TUpToTwoDigits = TOneDigit | `${TDigit1_9}${TDigit}`;
|
|
7
|
+
export type TUpToThreeDigits = TUpToTwoDigits | `${TDigit1_9}${TDigit}${TDigit}`;
|
|
8
|
+
export type TUpToFourDigits = TUpToThreeDigits | `${TDigit1_9}${TDigit}${TDigit}${TDigit}`;
|
|
9
|
+
export type TTwoDigitsMonth = TTwoDigits & TParseableInt<`0${TDigit1_9}` | '10' | '11' | '12'>;
|
|
10
|
+
export type TTwoDigitsDate = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | '30' | '31'>;
|
|
11
|
+
export type TTwoDigitsHour = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | '20' | '21' | '22' | '23' | '24'>;
|
|
12
|
+
export type TTwoDigitsMinute = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | `3${TDigit}` | `4${TDigit}` | `5${TDigit}`>;
|
|
13
|
+
export type TTwoDigitsSecond = TTwoDigits & TParseableInt<`0${TDigit1_9}` | `1${TDigit}` | `2${TDigit}` | `3${TDigit}` | `4${TDigit}` | `5${TDigit}`>;
|
|
14
|
+
export type TThreeDigitsMillisecond = TThreeDigits;
|
|
15
|
+
export type TFourDigitsYear = TFourDigits;
|
|
16
|
+
export type TFourDigitsMillisecond = `${'+' | '-'}${TThreeDigits}`;
|
|
17
|
+
export type TMonth = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
18
|
+
export 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;
|
|
19
|
+
export 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;
|
|
20
|
+
export type TDayOfWeek = 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
21
|
+
export 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;
|
|
22
|
+
export 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;
|
|
23
|
+
export 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;
|
|
24
|
+
export type TMillisecondOfSecond = TNumber0_1000;
|
|
25
|
+
export type TIso8601DateString = `${string}-${string}-${string}T${string}:${string}:${string}.${string}${string}`;
|
|
26
|
+
export type TIso8601DateUtcString = `${string}-${string}-${string}T${string}:${string}:${string}.${string}Z`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/.pnpm/typescript@5.7.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/.pnpm/small-date@2.0.1/node_modules/small-date/index.d.ts","../src/utils/functions/constant.ts","../src/sorting/types.ts","../src/sorting/comparisonchain.ts","../src/sorting/sorter.ts","../src/sorting/index.ts","../src/utils/nulls.ts","../src/utils/arrays/groupby.ts","../src/utils/arrays/indexby.ts","../src/utils/arrays/statistics.ts","../src/utils/arrays/uniqby.ts","../src/utils/arrays.ts","../src/utils/booleans.ts","../src/utils/empties.ts","../src/utils/errors/withtrycatch.ts","../src/utils/errors.ts","../src/utils/json.ts","../src/utils/numbers/round.ts","../src/utils/numbers.ts","../src/utils/primitives.ts","../src/time/timeunit.ts","../src/time/timebase.ts","../src/time/timeduration.ts","../src/utils/promises.ts","../src/utils/random.ts","../src/utils/records/entries.ts","../src/utils/records.ts","../src/utils/strings/stringparts.ts","../src/utils/strings.ts","../src/utils/index.ts","../src/utils/functions/iff.ts","../src/utils/functions.ts","../src/async/deferred.ts","../src/time/types.ts","../src/time/timeinstantbuilder.ts","../src/time/timeinstant.ts","../src/logger.ts","../src/optional.ts","../src/async/cancelabledeferred.ts","../src/time/timefrequency.ts","../src/async/ratethrottler.ts","../src/async/semaphore.ts","../src/async/index.ts","../src/lazy/lazy.ts","../src/lazy/lazyasync.ts","../src/lazy/index.ts","../src/time/randomtimeduration.ts","../src/time/timerange.ts","../src/time/index.ts","../src/upgrade/errors.ts","../src/upgrade/types.ts","../src/upgrade/gettransitionspath.ts","../src/upgrade/dataupgrader.ts","../src/upgrade/index.ts","../src/index.ts"],"fileIdsList":[[91],[90],[91,97,99,100],[91,98,113],[91,113],[64,88,95,96,101,104,107,112],[102,103],[88],[65],[88,94],[65,90],[60,61,88],[61,62,63],[79,81,92,94,98,105,106],[79,81,83],[79],[64,79,80,88,91,94],[81,88],[59,64,79,80,81,91,92,93],[65,90,92,94],[94,107],[88,108,109,110],[88,109],[109,111],[64,65,66,67,68,69,90],[70],[73],[74,90],[60,89,90],[65,70,71,72,74,75,77,78,82,83,85,87,90],[74],[65,74,76,90],[81,90],[77],[84],[65,70,86],[65,70,87]],"fileInfos":[{"version":"e41c290ef7dd7dab3493e6cbe5909e0148edf4a8dad0271be08edec368a0f7b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"4fd3f3422b2d2a3dfd5cdd0f387b3a8ec45f006c6ea896a4cb41264c2100bb2c","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"62bb211266ee48b2d0edf0d8d1b191f0c24fc379a82bd4c1692a082c540bc6b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"936e80ad36a2ee83fc3caf008e7c4c5afe45b3cf3d5c24408f039c1d47bdc1df","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"fef8cfad2e2dc5f5b3d97a6f4f2e92848eb1b88e897bb7318cef0e2820bceaab","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"f1e2a172204962276504466a6393426d2ca9c54894b1ad0a6c9dad867a65f876","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"b5ce7a470bc3628408429040c4e3a53a27755022a32fd05e2cb694e7015386c7","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"c77f0c58173b1b3364632db5ee4455bac69cbf0c494b5a777bf80ca4aa8c9560","impliedFormat":1},{"version":"2ad39d7999802d47e85e77152fc7b2819f9127b551102ec179b1f78cce242954","signature":"970715547588fa6a8217b5ae2eb62e3960370009390d013270ee5eea694e5c70"},{"version":"d3781289f931d1fd6da732725be3a924271f3126a60a11f738dab07a9de2f7d8","signature":"4d79eeb5415637be3229c2667895b56383253c77b8b33e61549b5128daf9e37a"},{"version":"9dd6c91ad0cc61ccf6cb430400942911c9898cc5cb568f71741821e7e3b26ec6","signature":"318fa1a3aea63a60b7b66160ac98a8b207968e4969cf41bac4453d4f062fc2dc"},{"version":"f81e13545a32f0e905158afc87f5fe966a0a74efbc167ec094b07aea3d12a6ca","signature":"8acbccc69dd0aeca47b8884ba49bf54b2523749862bfe29f0b4f7f402c6f5d3c"},{"version":"1ab20f387ef7fa5cf94272900952596792f583f45bbd58d9adf2d623349d060e","signature":"ec49ec1ca3ddc1fbcdb45f1740ccd72d20fbf450036286c4373d9d13ddf2c4a2"},{"version":"0d578fa07b7e41030f7ad5176898a0a70a092fc45a264ce67498f63e544344e1","signature":"eb96292ecf52597cf826715047ec8411375f0ac8a43d0bd12f87dd3190838a04"},{"version":"c503b2ee64acd7d07c1cb7e310f42a0917384a03cc1bdb7de10e0979523d9fa4","signature":"cc1520ea203e99e44c5b401650ea69aa41422db2b8c925e0ec55391bde11e0e7"},{"version":"e31542b0347f4025457278d7bc3ddc84529991059c1ab2b0b5bcb9b37cc33836","signature":"2f906b8d1966c352311c18c50f04d1fdf57ac78b8e7f4e0ba837253c6a02bf51"},{"version":"065815c5d2b778f409ae78a366079628d6b28c689647b358ee4cb854e92eead2","signature":"8da47ddef220dd11a8a0f431127f8d083ba95b7e2b45b266233812bcf1f13888"},{"version":"2fdcc3f88b19bda7bc74c8c6430b9e2f6eb6d252d812c508f48669a27b680d5f","signature":"e2ab4c29fa06a89dc35759aaf3354bb06cad41d3d6f1bf9e1ce482187cd1fb91"},{"version":"334fbcc8d8c79c7e87a57579cadde8d9b73b4fe6bf35cab40394600353c0bb7d","signature":"283bb26d51b9d0769247b89c21d91503cb3823fdcfda75cabf3a7fcc4d55e270"},{"version":"56571c3f44c6312462e8395ed75d05887dcbcb1581a0ad47dd72bcdbb898ea84","signature":"853de26cb0c4a51d7b511bf303ff4d6680bc18d36b3f2f6d7b8008c8927b58a1"},{"version":"80cfb7f027e1ed06149023ea32ba3d176db0325b675ade827d4cdf2b8cd715fc","signature":"9fc3664a9a2be65e8bf0ca4475f184a16c7a0b03e78c77cabe45e47d78bcd3db"},{"version":"1dddda79911dbd7ebfe881c7978fb4761be7a4d18f4367d2232fee867f1886d1","signature":"0992957d4775ed8a31ed20acbff806cc8f5eb4edd28e3071d36c2f16e6fa277f"},{"version":"2009cccc1fb281cb9233e13b14adb47b87ae0c72f7c73355d4ff0a536ad012b4","signature":"e537516e7b69cd96068554445428fd261d806d54ba92343fb91cac4120ae6017"},{"version":"c8493627adf08b4e0d48ebfb2724b2d1d227d26a71625f09b9f7601f5e847459","signature":"5db98cd7b060f49da05790a11db4314bbf4e7df3459462f37257991217d300b9"},{"version":"d0f71922ce0d6ce8aecef7b85158c6726e0db4d0ef23d71f2b14b9a2e5bef9fb","signature":"a29a11ea1f06a29ebc9d88a8439d78598d2d4977115a70705902c117d2a19e76"},{"version":"f2f9f6b43791f93f0cd2f09a5cee85243eb8ae831650b55a44f8d5b0fee14940","signature":"991a327a79d8b69993ac2ae5a6136cc96fa796d98e76860417061a0133231b68"},{"version":"70a58316dfec322f94bb980c05315faafd93f6fe6c56015efc7f0a4fb87636e2","signature":"d98d28f45f2fd50c72d82ea27d9fb213df06bc2456eb0748c657c6da8e77a1d4"},{"version":"cb6e4d47248ad5cbeed78f4164cf996fb276d54a580ac52e3a7feb92c4336d77","signature":"86463269677354ddc223e39011b4b5f231cdc5d072d08fb0e4b431a915e1f6eb"},{"version":"fe78af98b38dddb04bbf42a17e0ff5d3509ad062a97cd04d08cadbea7425627c","signature":"58686fcfd1c2f6e21d3dd7f52d347e73a9879aa634acd1baafe5f2c2e4c09e9a"},{"version":"3b85f92a95142735f41eec0f8a68cc62fa93f7d8963dea80d6016f1ae6af8e18","signature":"600f8c69a4fc9b519d19e4e95507a34e69a07c82c1bf572b736dc9f65680ef92"},{"version":"d3816328a097970f46726b8e2f34f1e66fab2d95a2463fe0a3a3460308fc06aa","signature":"0cce1783c4c412541b1118f66a401ee1076d2b45f6de005ffa10d7a3138bdbc3"},{"version":"1faddc195c50b660f7ee070409b174a7f469fcb479516a2c1ff6d1c98cc538dc","signature":"c6c89f5aba28d93c41bb32cb4963e04fde611f1a0f00479fe13ab8151f3b9732"},{"version":"f9b7540997405acdde3ddd1bc98c2a8ff0039f7dfde4dc699445a017c2311ec3","signature":"5d629ce88038b243d9c777e9c53696b49ed3391e2175a9b88dabb31a76079a06"},{"version":"1dd5d0c67c2d0ec79c71c42358558430a6dce7462c1e01e781c62fa7692601d1","signature":"a44dc51b8670d689e2b121418dd9c7a125905406786ee226eccf2c1e9bcbb57b"},{"version":"a12f80b0021d23f5d69f36f2d6aca668500011c39a1700fae1181998fc85b601","signature":"d0858da5bf20118f452fc36ac2e03115b274084215f8246ffb82ad278da00a7d"},{"version":"b1bed90df58555cf322c8db9c2385cde43cb4f51da32ca8ab27e5d9865b59a7d","signature":"cd8c66d55b062af0df39c84f41185885b993048e5c109982e3a315d1789a5f3f"},{"version":"33d19b3cb7117da8dc04e821cd39a8c3e796376139e6aa05bfd822dfa554bfae","signature":"d395782613b270de87b13d6331a397013e9753fc4428b00f2e294cc29e3e8d76"},{"version":"409daaf670e0781555140c48d214d855775841d1a74d74057a2f9c9b23a8ea93","signature":"cd6b7bbe6bdee5e60c4fbee6907d334808ea07a247374df93136231d359b4795"},{"version":"9f7954a3bc4fd40f8b65b54655a3c2e30871499cd2d151ec7e47f40d80035ecc","signature":"65cc505b6d6e6b6f058b49a2c81fde6a1ec806e49261ce71bd4ad8a671712483"},{"version":"d6859319cfab28518e99dba48a2dbb9392e2e112f2dac7911b055a003189b920","signature":"1f0e09320cb86d4f4f26386d828d9b66da11620d331f79073615026f5dbf6978"},{"version":"c3595b97fd7a5a98a6af20b81f87bdea93d963f1c39337739e605281aa964c4a","signature":"d3b1a67f87d6e77f7772bfc777e04387a6bf3d84eb2f18b454f9bd9cefa86afb"},{"version":"3c2ca70abf1d8db31f40785c88b68b356b5fecc93edf626cc31e0c38225f8a4d","signature":"c35d831c0cc2dc924d4fb0bd88bc8849d159243f78ec5f8f6e05bb40936bef7b"},{"version":"4f786f443a814b41002e24a3b88ff8bdfca26d070f462b7936d594aac428941f","signature":"5e6e8bae5d33abcdfa0ac4e02e6ad828b5977ca2e475ea8b71c50e8474ccaada"},{"version":"c4f88d5f3c6e0d1b87efd8d336d6cd4ef457db83c952de20b90d4808187c8450","signature":"ff1690eb4407b18a88ddc918e4311923bc1f787a8a8f678d5b03fe8922048177"},{"version":"f46c11b34a70c1196da95cf77b957469dbd6ec94e00e5074041392626c35fa76","signature":"15884642f06d3093d656d698d814e95599a96ee629468206791b359b5e4d137d"},{"version":"963e90bd6a94bd500329447e92ecb2be1efaab48d53d81e6f143dc63cb2aa76f","signature":"c6eff6bde8066f2980b221de77dc801f3a2a27525a9c3879d37426941b7a413c"},{"version":"1746aab5d9264c85832305e5ac252401199168629595ec2d65daccbb4e1778bd","signature":"655ff771dbe8906922d5081fd4ecffc1b2fe97521c9c400cc4f506b81f048645"},{"version":"141dac9588bca23bfc8a13b99560bae0cf818733218861bba342a5418e55d86f","signature":"3d58a3363bb571062abeb1fdc96e174e8a6a61bcdd3e7491c2bf65dbb5a17750"},{"version":"1169850a4c64b90116e950c9b1ed1647cc42cdc0406aaef72accb23fa31de94a","signature":"edaa819d2cda320db8a15b0345db7f7589cdc27fd94f8fb464f46677670ac427"},{"version":"0c244f63637cdd383fd0ba6912244f8146a9169eeaf885b2ef136e4d1baedd01","signature":"86122f878833e22a38a54656b9fe61736ba6c103b6a2fa01dae70458aec4353d"},{"version":"ba7ad8169c4e0cfeab946431d3e9a2def0f86c928580fcd767d0afb09b5c03f5","signature":"1a3a6cd1cc20eddc55d13ce8a54fabc0bebe0069b2d75d2c738e7d8aa94741bc"},{"version":"5253453362b3bb0b2d215c3ae66b850edb6f65bce45daaf4f2530b5292ab905b","signature":"9e7fcd385ecfdfa65958f8c734a2a73bbfd1ffca8f5ab0240629464e94f332a0"},{"version":"776155d42bfa1737a147a7f9ab63f0068b0f12279f86757347d605d8550eae16","signature":"0428da86bb5e41a6da4aedec6af5fb004a74731c9d56bcbe2b6348f1bf44744a"},{"version":"c3d59784aa9468ae61f7f99359eea4b3a9ccc6aec1bb46869aea049c0a0b8812","signature":"975d013c31f48ecb26867d0f98f13d2eaebb4af2bfbe6b5fd9a4d38fdccd5656"},{"version":"f5cb5ee6dfc305bbad84b2990954ce9557db25146764b81e91a22f22b4c650dd","signature":"5022494c36b44f458140adf6060c2f14e107b8984de8596eee5dbcb70cdb9f6b"},{"version":"6f4a74e34595aa6420c4a1df1ff788d1686f7bdfc7259de90d0102f4cf83555f","signature":"12cf7f6e0e2bf8d8e9b8a79d1adae5f8706736dee1e5d25279785ce45c7b0b27"},{"version":"5b2927131599d55e0ee730c7a2afc764ff39199a5d186b510fc3eca82f4ef1ff","signature":"d6fc507f1c2ecd14c0882a0e00a1ba2a580c6e45550a3a5e868d7bee4b1922b6"},{"version":"1beb76f20b97f76d5ac48caa921161255c72c59e93a8571871b069b8dff2bed2","signature":"340b2a38ab87e8aa617f4021a1e4c916453f80cc27d908ab084a1798be18b5c0"},{"version":"2ebd1a1e8ba106bea54bf6cf59f2909a27864c7b35ff1b828d8c7634a6a62179","signature":"f0561579997f9cfd97a6e991d806999dd3b48b6476b03e7d33ca6ea06297b21c"},{"version":"74dc5d77ab2d43e26ae180d7bef1780d7fa0209ef643827ac601c2fdda759321","signature":"c78dfc67b95896fccbc0e65345294a53877ed8e6424c5b8a763c709b68a1c645"},{"version":"22577c900676846354224462f8a6b3e0e5033cd14a501ea46107e67a4ab7863f","signature":"70fd81e903686acf6e994565edb1588cc619b816646ea1a89ac9a47b45d25737"},{"version":"569c58f09117e840594ae628aec2ca65eaa02f3322e8c70cbf5ba8f1115a04b2","signature":"a4321a18e9f87f996672902385e77ad1fd93f251f4e665f849fbdc32bbfb1cdc"}],"root":[[60,113]],"options":{"allowImportingTsExtensions":true,"composite":true,"declaration":true,"emitDeclarationOnly":true,"emitDecoratorMetadata":true,"esModuleInterop":true,"experimentalDecorators":true,"module":7,"noFallthroughCasesInSwitch":true,"noImplicitAny":false,"noImplicitReturns":true,"noImplicitThis":true,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":true,"strictBindCallApply":true,"strictFunctionTypes":true,"strictNullChecks":true,"strictPropertyInitialization":true,"target":9,"tsBuildInfoFile":"./tsconfig.tsbuildinfo"},"referencedMap":[[97,1],[91,2],[101,3],[99,4],[100,5],[113,6],[104,7],[102,8],[103,9],[95,10],[96,11],[62,12],[64,13],[63,12],[61,2],[107,14],[105,15],[80,16],[81,17],[98,18],[94,19],[93,20],[106,21],[92,8],[111,22],[110,23],[112,24],[109,8],[70,25],[66,8],[67,8],[68,26],[69,2],[74,27],[73,28],[90,29],[89,8],[88,30],[75,31],[65,2],[77,32],[82,33],[83,34],[85,35],[84,8],[87,36],[86,37]],"latestChangedDtsFile":"./index.d.ts","version":"5.7.3"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TJsonSerializable } from "../utils/index.js";
|
|
2
|
+
import { EmptyUpgradeError, UnavailableUpgradeError } from "./errors";
|
|
3
|
+
import { TPossibleFromVersion, TPossibleVersion, TUpgradable, TUpgradeFunction, TVersionMap } from "./types";
|
|
4
|
+
declare const VERSION_FIELD = "$version";
|
|
5
|
+
export interface IDataUpgrader<XStar extends TUpgradable, XLatest extends XStar> {
|
|
6
|
+
upgrade(data: XStar): Promise<XLatest>;
|
|
7
|
+
}
|
|
8
|
+
export declare class DataUpgrader<X extends TUpgradable, XLatest extends X> implements IDataUpgrader<X, XLatest> {
|
|
9
|
+
private latestVersion;
|
|
10
|
+
private transitions;
|
|
11
|
+
private constructor();
|
|
12
|
+
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;
|
|
13
|
+
upgrade(data: X): Promise<XLatest>;
|
|
14
|
+
isLatestVersion(data: X): data is XLatest;
|
|
15
|
+
static create<X extends TUpgradable, XLatestVersion extends X>(latest: XLatestVersion[typeof VERSION_FIELD]): DataUpgrader<X, XLatestVersion>;
|
|
16
|
+
static Errors: {
|
|
17
|
+
readonly EmptyUpgrade: typeof EmptyUpgradeError;
|
|
18
|
+
readonly UnavailableUpgrade: typeof UnavailableUpgradeError;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare function isUpgradable(obj: TJsonSerializable): obj is TUpgradable;
|
|
22
|
+
export default DataUpgrader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class UnavailableUpgradeError<T> extends Error {
|
|
2
|
+
readonly data: T;
|
|
3
|
+
readonly from: number;
|
|
4
|
+
readonly to: number;
|
|
5
|
+
constructor(data: T, from: number, to: number);
|
|
6
|
+
}
|
|
7
|
+
export declare class EmptyUpgradeError<T> extends Error {
|
|
8
|
+
readonly data: T;
|
|
9
|
+
readonly from: number;
|
|
10
|
+
readonly to: number;
|
|
11
|
+
constructor(data: T, from: number, to: number);
|
|
12
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TMaybe } from "../utils";
|
|
2
|
+
import { TTransition, TTransitionMatrix, TUpgradable } from "./types";
|
|
3
|
+
export default function getTransitionsPath<XStar extends TUpgradable, XFromNumber extends XStar["$version"], XToNumber extends XStar["$version"]>(matrix: TTransitionMatrix<XStar>, from: XFromNumber, to: XToNumber): TMaybe<TTransition<XStar, XFromNumber, XToNumber>[]>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TFunction, TJsonObject, TPromisable } from "../utils";
|
|
2
|
+
export type TUpgradable = TJsonObject & {
|
|
3
|
+
$version: number;
|
|
4
|
+
};
|
|
5
|
+
export type TUpgradableAtVersion<XStar extends TUpgradable, N extends XStar["$version"]> = Extract<XStar, {
|
|
6
|
+
$version: N;
|
|
7
|
+
}>;
|
|
8
|
+
export type TVersionMap<XStar extends TUpgradable> = {
|
|
9
|
+
[XVersionNumber in XStar["$version"]]: TUpgradableAtVersion<XStar, XVersionNumber>;
|
|
10
|
+
};
|
|
11
|
+
export type TPossibleVersion<XStar extends TUpgradable> = XStar["$version"] & number;
|
|
12
|
+
export type TPossibleFromVersion<XStar extends TUpgradable, XLatest extends XStar> = Exclude<TPossibleVersion<XStar>, XLatest["$version"]>;
|
|
13
|
+
export type TUpgradeFunction<XStar extends TUpgradable, XFrom extends XStar, XTo extends XStar> = TFunction<Readonly<TVersionMap<XStar>[XFrom["$version"]]>, TPromisable<TVersionMap<XStar>[XTo["$version"]]>>;
|
|
14
|
+
export type TTransition<XStar extends TUpgradable, XFromNumber extends XStar["$version"], XToNumber extends XStar["$version"], XFrom extends Extract<XStar, {
|
|
15
|
+
$version: XFromNumber;
|
|
16
|
+
}> = Extract<XStar, {
|
|
17
|
+
$version: XFromNumber;
|
|
18
|
+
}>, XTo extends Extract<XStar, {
|
|
19
|
+
$version: XToNumber;
|
|
20
|
+
}> = Extract<XStar, {
|
|
21
|
+
$version: XToNumber;
|
|
22
|
+
}>> = {
|
|
23
|
+
from: XFromNumber;
|
|
24
|
+
to: XToNumber;
|
|
25
|
+
apply: TUpgradeFunction<XStar, XFrom, XTo>;
|
|
26
|
+
};
|
|
27
|
+
export type TTransitionMatrix<XStar extends TUpgradable> = Partial<{
|
|
28
|
+
[XTo in XStar["$version"]]: Partial<{
|
|
29
|
+
[XFrom in XStar["$version"]]: TTransition<XStar, XFrom, XTo>;
|
|
30
|
+
}>;
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TFunction, TKeysOfType, TReadableArray } from "..";
|
|
2
|
+
export declare function groupByString<V, K extends TKeysOfType<V, string>>(arr: TReadableArray<V>, field: K): Record<V[K] & string, V[]>;
|
|
3
|
+
export declare function groupByNumber<V, K extends TKeysOfType<V, number>>(arr: TReadableArray<V>, field: K): Record<V[K] & number, V[]>;
|
|
4
|
+
export declare function groupByBoolean<V, K extends TKeysOfType<V, boolean>>(arr: TReadableArray<V>, field: K): Record<"true" | "false", V[]>;
|
|
5
|
+
export declare function groupBySymbol<V, K extends TKeysOfType<V, symbol>>(arr: TReadableArray<V>, field: K): Record<V[K] & symbol, V[]>;
|
|
6
|
+
export declare function groupByStringWith<V, K extends string>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<K, V[]>;
|
|
7
|
+
export declare function groupByNumberWith<V, K extends number>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<K, V[]>;
|
|
8
|
+
export declare function groupByBooleanWith<V, K extends boolean>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<"true" | "false", V[]>;
|
|
9
|
+
export declare function groupBySymbolWith<V, K extends symbol>(arr: TReadableArray<V>, getter: TFunction<V, K>): Record<K, V[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TFunction, TKeysOfType } from "..";
|
|
2
|
+
export declare function indexByString<V, K extends TKeysOfType<V, string>>(arr: V[], field: K): Record<V[K] & string, V>;
|
|
3
|
+
export declare function indexByNumber<V, K extends TKeysOfType<V, number>>(arr: V[], field: K): Record<V[K] & number, V>;
|
|
4
|
+
export declare function indexBySymbol<V, K extends TKeysOfType<V, symbol>>(arr: V[], field: K): Record<V[K] & symbol, V>;
|
|
5
|
+
export declare function indexByStringWith<V>(arr: V[], getter: TFunction<V, string>): Record<string, V>;
|
|
6
|
+
export declare function indexByNumberWith<V>(arr: V[], getter: TFunction<V, number>): Record<number, V>;
|
|
7
|
+
export declare function indexBySymbolWith<V>(arr: V[], getter: TFunction<V, symbol>): Record<symbol, V>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TReadableArray } from "../arrays.js";
|
|
2
|
+
export declare function average(arr: TReadableArray<number>): number;
|
|
3
|
+
export declare function sum(arr: TReadableArray<number>): number;
|
|
4
|
+
export declare function sumBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
|
|
5
|
+
export declare function min(arr: TReadableArray<number>): number;
|
|
6
|
+
export declare function minBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
|
|
7
|
+
export declare function max(arr: TReadableArray<number>): number;
|
|
8
|
+
export declare function maxBy<T>(arr: TReadableArray<T>, getter: (t: T) => number): number;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { TComparisonFunction } from "../sorting/index.js";
|
|
2
|
+
import type { TAccumulator, TBiPredicate, TPredicate, TTransformer } from "./functions.js";
|
|
3
|
+
import { type TMaybe } from "./nulls.js";
|
|
4
|
+
export * from './arrays/groupBy.js';
|
|
5
|
+
export * from './arrays/indexBy.js';
|
|
6
|
+
export * from './arrays/statistics.js';
|
|
7
|
+
export * from './arrays/uniqBy.js';
|
|
8
|
+
export type TReadableArray<T> = Array<T> | ReadonlyArray<T>;
|
|
9
|
+
export type TArrayable<T> = T | T[];
|
|
10
|
+
export type TEmptyArray = [];
|
|
11
|
+
export declare function ensureArray<const T>(t: T | Array<T> | null | undefined): Array<T>;
|
|
12
|
+
export declare function ensureReadableArray<const T>(t: T | Array<T> | ReadonlyArray<T> | null | undefined): TReadableArray<T>;
|
|
13
|
+
export declare function isArray<const T>(t: unknown): t is Array<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Generate a new copy of an array with:
|
|
16
|
+
* - the first instance of an item matching the predicate being replaced with the given argument
|
|
17
|
+
* - the given argument added as last item of the array if the predicate did not produce a match
|
|
18
|
+
* @param arr - the original array of items
|
|
19
|
+
* @param item - the item to insert or update
|
|
20
|
+
* @param predicate - a function that returns true iff an item is equal to the given argument
|
|
21
|
+
* @returns a new copy of the array with the item updated or added in last place
|
|
22
|
+
*/
|
|
23
|
+
export declare function upsert<T>(arr: ReadonlyArray<T>, item: T, isEqual: TBiPredicate<T>): Array<T>;
|
|
24
|
+
export declare function range(start: number, end: number): Array<number>;
|
|
25
|
+
export declare function fill<T>(length: number, value: T): Array<T>;
|
|
26
|
+
export 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)>;
|
|
27
|
+
export 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)>;
|
|
28
|
+
export declare function reverse<T>(arr: TReadableArray<T>): Array<T>;
|
|
29
|
+
export declare function first<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
|
|
30
|
+
export declare function last<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
|
|
31
|
+
export declare const head: typeof first;
|
|
32
|
+
export declare function tail<T>(arr: TReadableArray<T>): T[];
|
|
33
|
+
export declare function sortedArray<T>(arr: Array<T>, sortFn?: TComparisonFunction<T> | undefined): Array<T>;
|
|
34
|
+
export declare function sortedArray<T>(arr: ReadonlyArray<T>, sortFn?: TComparisonFunction<T> | undefined): ReadonlyArray<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Custom implementation of includes which allows checking for arbitrary items inside the array.
|
|
37
|
+
*/
|
|
38
|
+
export declare function includes<T>(arr: TReadableArray<T>, item: unknown, fromIndex?: number): boolean;
|
|
39
|
+
export declare function mapTruthys<T, R>(arr: Array<T>, mapper: (value: T, index: number, array: T[]) => R | undefined): Array<R>;
|
|
40
|
+
export declare function flatMapTruthys<T, R>(arr: Array<T>, mapper: (value: T, index: number, array: T[]) => R | undefined): Array<R>;
|
|
41
|
+
export declare function filterMap<T, R>(array: T[], filterFn: TPredicate<T>, mapFn: TTransformer<T, R>): R[];
|
|
42
|
+
export declare function filterMapReduce<T, U, R>(array: T[], filterFn: TPredicate<T>, mapFn: TTransformer<T, U>, reduceFn: TAccumulator<R, U>, initialValue: R): R;
|
|
43
|
+
/**
|
|
44
|
+
* 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.
|
|
45
|
+
* @param arr the array of items
|
|
46
|
+
* @param predicate the predicate to use to partition the array
|
|
47
|
+
* @returns a tuple, where the first array contains items matching the predicate, and the second array contains items not matching the predicate.
|
|
48
|
+
*/
|
|
49
|
+
export declare function partition<T>(arr: T[], predicate: TPredicate<T>): [T[], T[]];
|
|
50
|
+
/**
|
|
51
|
+
* Maps the first truthy value in the array using the provided mapping function.
|
|
52
|
+
* @param arr - The array of items.
|
|
53
|
+
* @param mapFn - The mapping function.
|
|
54
|
+
* @returns The first truthy value returned by the mapping function, or null if no truthy value is found.
|
|
55
|
+
*/
|
|
56
|
+
export declare function mapFirstTruthy<T, R>(arr: T[], mapFn: TTransformer<T, R>): R | null;
|
|
57
|
+
export declare function makeArrayEmpty(arr: unknown[]): void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define a new type that is true if T is the empty object, false otherwise.
|
|
3
|
+
*/
|
|
4
|
+
export type TIsEmptyObject<T> = keyof T extends never ? true : false;
|
|
5
|
+
/**
|
|
6
|
+
* 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/>
|
|
7
|
+
* This type can be used as function argument, to conditionally require an argument based on type T.<br/>
|
|
8
|
+
* Usage example:
|
|
9
|
+
* ```
|
|
10
|
+
* type TMetadata = { a: {}, b: {}, c: { x: 1 } };
|
|
11
|
+
* function foo<X extends keyof TMetadata>( type: X, metadata: TMetadata[X] ) { ... };
|
|
12
|
+
* export function fooWrapper<X extends keyof TMetadata>( type: X, ...args: TConditionalOptionalType<TMetadata[X]> ) {
|
|
13
|
+
* const bar = foo( type, args.length === 0 ? void 0 : args[ 0 ] );
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export type TConditionalOptionalType<T> = TIsEmptyObject<T> extends true ? [] : [T];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type TFunction, type TTransformer } from "../functions.js";
|
|
2
|
+
export declare function withTryCatch<R>(fn: TFunction<void, R>, errMapFn?: TTransformer<Error, Error>): [R, undefined] | [undefined, Error];
|
|
3
|
+
export declare function withTryCatchAsync<R>(fn: TFunction<void, Promise<R>>, errMapFn: TTransformer<Error, Error>): Promise<[R, undefined] | [undefined, Error]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function constant<T>(v: T): () => T;
|
|
2
|
+
export declare function identity<T>(t: T): T;
|
|
3
|
+
export default constant;
|
|
4
|
+
export declare const constantNull: () => null;
|
|
5
|
+
export declare const constantTrue: () => boolean;
|
|
6
|
+
export declare const constantFalse: () => boolean;
|
|
7
|
+
export declare const alwaysTrue: () => boolean;
|
|
8
|
+
export declare const alwaysFalse: () => boolean;
|
|
9
|
+
export declare const constantZero: () => number;
|
|
10
|
+
export declare const constantOne: () => number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TPredicate } from "..";
|
|
2
|
+
type TBooleanOrPredicate = boolean | TPredicate<void>;
|
|
3
|
+
type TIff<T> = {
|
|
4
|
+
elseIf<R>(pred: TBooleanOrPredicate, valueIfTrue: R): TIff<T | R>;
|
|
5
|
+
otherwise<R>(valueIfElse: R): T | R;
|
|
6
|
+
};
|
|
7
|
+
export declare function iff<T>(firstPredicate: TBooleanOrPredicate, valueIfTrue: T): TIff<T>;
|
|
8
|
+
export default iff;
|