@zelgadis87/utils-core 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Lazy.d.ts +21 -0
- package/dist/LazyAsync.d.ts +23 -0
- 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 +27 -0
- package/dist/async/RateThrottler.d.ts +12 -0
- package/dist/async/Semaphore.d.ts +10 -0
- package/dist/async/index.d.ts +4 -0
- package/dist/index.d.ts +11 -0
- package/dist/random/index.d.ts +2 -0
- package/dist/random/randomInterval.d.ts +1 -0
- package/dist/random/randomPercentage.d.ts +1 -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 +137 -0
- package/dist/time/TimeInstantBuilder.d.ts +77 -0
- package/dist/time/TimeUnit.d.ts +17 -0
- package/dist/time/index.d.ts +6 -0
- package/dist/time/types.d.ts +26 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/arrays.d.ts +33 -0
- package/dist/types/booleans.d.ts +2 -0
- package/dist/types/functions.d.ts +20 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/json.d.ts +6 -0
- package/dist/types/nulls.d.ts +8 -0
- package/dist/types/numbers.d.ts +31 -0
- package/dist/types/promises.d.ts +6 -0
- package/dist/types/records.d.ts +14 -0
- package/dist/types/strings.d.ts +40 -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/asError.d.ts +1 -0
- package/dist/utils/bindThis.d.ts +1 -0
- package/dist/utils/constant.d.ts +8 -0
- package/dist/utils/entries.d.ts +4 -0
- package/dist/utils/groupBy.d.ts +7 -0
- package/dist/utils/iff.d.ts +8 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/indexBy.d.ts +7 -0
- package/dist/utils/jsonCloneDeep.d.ts +2 -0
- package/dist/utils/math.d.ts +9 -0
- package/dist/utils/noop.d.ts +1 -0
- package/dist/utils/omit.d.ts +2 -0
- package/dist/utils/pad.d.ts +3 -0
- package/dist/utils/pluralize.d.ts +1 -0
- package/dist/utils/round.d.ts +8 -0
- package/dist/utils/sortBy.d.ts +7 -0
- package/dist/utils/throttle.d.ts +3 -0
- package/dist/utils/uniq.d.ts +1 -0
- package/dist/utils/uniqBy.d.ts +2 -0
- package/dist/utils/uniqByKey.d.ts +1 -0
- package/dist/utils/upsert.d.ts +0 -0
- package/dist/utils/withTryCatch.d.ts +2 -0
- package/dist/utils/withTryCatchAsync.d.ts +2 -0
- package/dist/utils/wrap.d.ts +1 -0
- package/esbuild/index.cjs +2670 -0
- package/esbuild/index.mjs +2518 -0
- package/package.json +159 -0
- package/src/Lazy.ts +77 -0
- package/src/LazyAsync.ts +100 -0
- package/src/Logger.ts +44 -0
- package/src/Optional.ts +172 -0
- package/src/async/CancelableDeferred.ts +36 -0
- package/src/async/Deferred.ts +84 -0
- package/src/async/RateThrottler.ts +46 -0
- package/src/async/Semaphore.ts +45 -0
- package/src/async/index.ts +6 -0
- package/src/index.ts +13 -0
- package/src/random/index.ts +3 -0
- package/src/random/randomInterval.ts +4 -0
- package/src/random/randomPercentage.ts +6 -0
- package/src/sorting/ComparisonChain.ts +209 -0
- package/src/sorting/Sorter.ts +357 -0
- package/src/sorting/index.ts +5 -0
- package/src/sorting/types.ts +7 -0
- package/src/time/RandomTimeDuration.ts +21 -0
- package/src/time/TimeBase.ts +113 -0
- package/src/time/TimeDuration.ts +296 -0
- package/src/time/TimeFrequency.ts +28 -0
- package/src/time/TimeInstant.ts +488 -0
- package/src/time/TimeInstantBuilder.ts +126 -0
- package/src/time/TimeUnit.ts +43 -0
- package/src/time/index.ts +8 -0
- package/src/time/types.ts +56 -0
- package/src/types/arrays.ts +89 -0
- package/src/types/booleans.ts +8 -0
- package/src/types/functions.ts +27 -0
- package/src/types/index.ts +18 -0
- package/src/types/json.ts +5 -0
- package/src/types/nulls.ts +33 -0
- package/src/types/numbers.ts +80 -0
- package/src/types/promises.ts +23 -0
- package/src/types/records.ts +21 -0
- package/src/types/strings.ts +143 -0
- package/src/upgrade/DataUpgrader.ts +100 -0
- package/src/upgrade/errors.ts +25 -0
- package/src/upgrade/getTransitionsPath.ts +89 -0
- package/src/upgrade/index.ts +4 -0
- package/src/upgrade/types.ts +36 -0
- package/src/utils/asError.ts +12 -0
- package/src/utils/bindThis.ts +4 -0
- package/src/utils/constant.ts +9 -0
- package/src/utils/entries.ts +13 -0
- package/src/utils/groupBy.ts +39 -0
- package/src/utils/iff.ts +26 -0
- package/src/utils/index.ts +24 -0
- package/src/utils/indexBy.ts +36 -0
- package/src/utils/jsonCloneDeep.ts +31 -0
- package/src/utils/math.ts +44 -0
- package/src/utils/noop.ts +2 -0
- package/src/utils/omit.ts +8 -0
- package/src/utils/pad.ts +20 -0
- package/src/utils/pluralize.ts +20 -0
- package/src/utils/round.ts +24 -0
- package/src/utils/sortBy.ts +27 -0
- package/src/utils/throttle.ts +10 -0
- package/src/utils/uniq.ts +6 -0
- package/src/utils/uniqBy.ts +15 -0
- package/src/utils/uniqByKey.ts +5 -0
- package/src/utils/upsert.ts +2 -0
- package/src/utils/withTryCatch.ts +10 -0
- package/src/utils/withTryCatchAsync.ts +6 -0
- package/src/utils/wrap.ts +4 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ICancelablePromise } from "../async/Deferred.js";
|
|
2
|
+
import { TComparisonResult } from "../sorting/index.js";
|
|
3
|
+
import { TTimeoutHandle, TVoidFunction } from "../types";
|
|
4
|
+
import TimeBase from "./TimeBase";
|
|
5
|
+
import TimeDuration from "./TimeDuration";
|
|
6
|
+
import { TTimeInstantBuilder, TTimeInstantCreationParameters } from "./TimeInstantBuilder.js";
|
|
7
|
+
import TimeUnit from "./TimeUnit";
|
|
8
|
+
import { TDayOfMonth, TDayOfWeek, TFourDigitsMillisecond, TFourDigitsYear, TIso8601DateString, TIso8601DateUtcString, TMonth, TThreeDigitsMillisecond, TTwoDigitsDate, TTwoDigitsHour, TTwoDigitsMinute, TTwoDigitsMonth, TTwoDigitsSecond, TWeekNumber } from "./types";
|
|
9
|
+
export declare class TimeInstant extends TimeBase<TimeInstant> {
|
|
10
|
+
protected constructor(number: number, unit: TimeUnit);
|
|
11
|
+
protected create(value: number, unit: TimeUnit): TimeInstant;
|
|
12
|
+
addDuration(duration: TimeDuration): TimeInstant;
|
|
13
|
+
removeDuration(duration: TimeDuration): TimeInstant;
|
|
14
|
+
distanceFrom(instant: TimeInstant): TimeDuration;
|
|
15
|
+
distanceFromNow(): TimeDuration;
|
|
16
|
+
distanceFromStartOfDay(): TimeDuration;
|
|
17
|
+
atStartOfDay(): TimeInstant;
|
|
18
|
+
distanceFromEndOfDay(): TimeDuration;
|
|
19
|
+
atEndOfDay(): TimeInstant;
|
|
20
|
+
/** @deprecated[2024-10-24]: Use #promise() instead. */
|
|
21
|
+
timeout(cb: () => unknown): TTimeoutHandle;
|
|
22
|
+
promise(): ICancelablePromise<void>;
|
|
23
|
+
delay(cb: () => unknown): {
|
|
24
|
+
cancel: TVoidFunction;
|
|
25
|
+
};
|
|
26
|
+
isToday(): boolean;
|
|
27
|
+
asTimeString(): string;
|
|
28
|
+
asDateString(): string;
|
|
29
|
+
asIso8601(): TIso8601DateString;
|
|
30
|
+
asIso8601UTC(): TIso8601DateUtcString;
|
|
31
|
+
asHumanTimestamp(): string;
|
|
32
|
+
get twoDigitsDays(): TTwoDigitsDate;
|
|
33
|
+
get twoDigitsMonths(): TTwoDigitsMonth;
|
|
34
|
+
get fourDigitsYears(): TFourDigitsYear;
|
|
35
|
+
get twoDigitsHours(): TTwoDigitsHour;
|
|
36
|
+
get twoDigitsMinutes(): TTwoDigitsMinute;
|
|
37
|
+
get twoDigitsSeconds(): TTwoDigitsMinute;
|
|
38
|
+
get threeDigitsMilliseconds(): TThreeDigitsMillisecond;
|
|
39
|
+
get twoDigitsDaysUTC(): TTwoDigitsDate;
|
|
40
|
+
get twoDigitsMonthsUTC(): TTwoDigitsMonth;
|
|
41
|
+
get fourDigitsYearsUTC(): TFourDigitsYear;
|
|
42
|
+
get twoDigitsHoursUTC(): TTwoDigitsHour;
|
|
43
|
+
get twoDigitsMinutesUTC(): TTwoDigitsMinute;
|
|
44
|
+
get twoDigitsSecondsUTC(): TTwoDigitsSecond;
|
|
45
|
+
get threeDigitsMillisecondsUTC(): TThreeDigitsMillisecond;
|
|
46
|
+
get fourDigitsTimezoneOffset(): TFourDigitsMillisecond;
|
|
47
|
+
protected doGetTwoDigitsDays(date: Date): TTwoDigitsDate;
|
|
48
|
+
protected doGetTwoDigitsMonths(date: Date): TTwoDigitsMonth;
|
|
49
|
+
protected doGetFourDigitsYears(date: Date): TFourDigitsYear;
|
|
50
|
+
protected doGetTwoDigitsHours(date: Date): TTwoDigitsHour;
|
|
51
|
+
protected doGetTwoDigitsMinutes(date: Date): TTwoDigitsMinute;
|
|
52
|
+
protected doGetTwoDigitsSeconds(date: Date): TTwoDigitsMinute;
|
|
53
|
+
protected doGetThreeDigitsMilliseconds(date: Date): TThreeDigitsMillisecond;
|
|
54
|
+
protected doGetFourDigitsTimezoneOffset(date: Date): TFourDigitsMillisecond;
|
|
55
|
+
asUnixTimestamp(): number;
|
|
56
|
+
asDate(): Date;
|
|
57
|
+
asDateUTC(): Date;
|
|
58
|
+
get isInThePast(): boolean;
|
|
59
|
+
get isInTheFuture(): boolean;
|
|
60
|
+
isAfter(other: TimeInstant): boolean;
|
|
61
|
+
isBefore(other: TimeInstant): boolean;
|
|
62
|
+
compareTo(other: TimeInstant): TComparisonResult;
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated[04/07/2023]: Use distanceFromNow instead
|
|
65
|
+
*/
|
|
66
|
+
fromNow(): TimeDuration;
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated[04/07/2023]: Use distanceFrom instead
|
|
69
|
+
*/
|
|
70
|
+
from(instant: TimeInstant): TimeDuration;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated[04/07/2023]: Use distanceFromUnixTimestamp instead
|
|
73
|
+
*/
|
|
74
|
+
fromTimestamp(timestamp: number): TimeDuration;
|
|
75
|
+
distanceFromUnixTimestamp(timestamp: number): TimeDuration;
|
|
76
|
+
atTime(parameters: Partial<TTimeInstantCreationParameters & {
|
|
77
|
+
year: never;
|
|
78
|
+
month: never;
|
|
79
|
+
date: never;
|
|
80
|
+
}>): TimeInstant;
|
|
81
|
+
atDate(parameters: Partial<TTimeInstantCreationParameters & {
|
|
82
|
+
hours: never;
|
|
83
|
+
minutes: never;
|
|
84
|
+
seconds: never;
|
|
85
|
+
milliseconds: never;
|
|
86
|
+
}>): TimeInstant;
|
|
87
|
+
at(parameters: Partial<TTimeInstantCreationParameters>): TimeInstant;
|
|
88
|
+
isBetween(start: TimeInstant, end: TimeInstant): boolean;
|
|
89
|
+
static fromDate(date: Date): TimeInstant;
|
|
90
|
+
static fromUnixTimestamp(unixTimestamp: number): TimeInstant;
|
|
91
|
+
static fromUnixSeconds(unixSeconds: number): TimeInstant;
|
|
92
|
+
static fromParameters(parameters: Partial<TTimeInstantCreationParameters>, referenceDate?: Date | TimeInstant): TimeInstant;
|
|
93
|
+
static greatest(instant1: TimeInstant, instant2: TimeInstant): TimeInstant;
|
|
94
|
+
static lowest(instant1: TimeInstant, instant2: TimeInstant): TimeInstant;
|
|
95
|
+
static builder(): TTimeInstantBuilder;
|
|
96
|
+
/**
|
|
97
|
+
* @deprecated[19/07/2023] Use {@link fromParameters} instead.
|
|
98
|
+
*/
|
|
99
|
+
static fromUnits({ date, month, year, hours, minutes, seconds }: {
|
|
100
|
+
date: number;
|
|
101
|
+
month: number;
|
|
102
|
+
year: number;
|
|
103
|
+
hours?: number;
|
|
104
|
+
minutes?: number;
|
|
105
|
+
seconds?: number;
|
|
106
|
+
}): TimeInstant;
|
|
107
|
+
static fromIso8601(str: TIso8601DateString): TimeInstant;
|
|
108
|
+
static now(): TimeInstant;
|
|
109
|
+
static get currentTimeStamp(): number;
|
|
110
|
+
static compare(a: TimeInstant, b: TimeInstant): TComparisonResult;
|
|
111
|
+
roundedToStartOf(unit: TimeUnit): TimeInstant;
|
|
112
|
+
roundedToEndOf(unit: TimeUnit): TimeInstant;
|
|
113
|
+
roundedToNext(unit: TimeUnit, factor?: number): TimeInstant;
|
|
114
|
+
roundedToPrevious(unit: TimeUnit, factor?: number): TimeInstant;
|
|
115
|
+
roundedTo(unit: TimeUnit, factor?: number): TimeInstant;
|
|
116
|
+
get dayOfMonth(): TDayOfMonth;
|
|
117
|
+
get dayOfWeek(): TDayOfWeek;
|
|
118
|
+
get month(): TMonth;
|
|
119
|
+
get year(): number;
|
|
120
|
+
/**
|
|
121
|
+
* Returns the week number represented by this instant, according to the ISO 8601 standard.
|
|
122
|
+
* 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.
|
|
123
|
+
*/
|
|
124
|
+
get weekNumber(): {
|
|
125
|
+
weekNumber: TWeekNumber;
|
|
126
|
+
year: number;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* This method is used to provide a better DX when inspecting a TimeInstant object in DevTools.
|
|
130
|
+
*/
|
|
131
|
+
protected get _time(): string;
|
|
132
|
+
toString(): string;
|
|
133
|
+
static ZERO: TimeInstant;
|
|
134
|
+
static fromJSON(ms: number): TimeInstant;
|
|
135
|
+
}
|
|
136
|
+
export declare function isTimeInstant(x: unknown): x is TimeInstant;
|
|
137
|
+
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"]) => any;
|
|
66
|
+
month: (x: TTimeInstantCreationParameters["month"]) => any;
|
|
67
|
+
date: (x: TTimeInstantCreationParameters["date"]) => any;
|
|
68
|
+
hours: (x: TTimeInstantCreationParameters["hours"]) => any;
|
|
69
|
+
minutes: (x: TTimeInstantCreationParameters["minutes"]) => any;
|
|
70
|
+
seconds: (x: TTimeInstantCreationParameters["seconds"]) => any;
|
|
71
|
+
milliseconds: (x: TTimeInstantCreationParameters["milliseconds"]) => any;
|
|
72
|
+
values: (x: Partial<TTimeInstantCreationParameters>) => any;
|
|
73
|
+
relativeTo: (x: TimeInstant | Date) => any;
|
|
74
|
+
build: () => TimeInstant;
|
|
75
|
+
};
|
|
76
|
+
export type TTimeInstantBuilder = ReturnType<typeof timeInstantBuilder>;
|
|
77
|
+
export {};
|
|
@@ -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,6 @@
|
|
|
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 { default as TimeUnit } from './TimeUnit';
|
|
6
|
+
export * from './types';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TDigit, TDigit1_9, TNumber0_1000, TParseableInt } from "../types";
|
|
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
|
+
{"program":{"fileNames":["../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es5.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2016.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.dom.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.decorators.d.ts","../../../../auto-harem-heroes/node_modules/.pnpm/typescript@5.5.4/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/types/functions.ts","../src/sorting/types.ts","../src/utils/constant.ts","../src/sorting/comparisonchain.ts","../src/sorting/sorter.ts","../src/sorting/index.ts","../src/types/nulls.ts","../src/types/arrays.ts","../src/types/booleans.ts","../src/types/json.ts","../src/types/numbers.ts","../src/async/deferred.ts","../src/random/randominterval.ts","../src/random/randompercentage.ts","../src/random/index.ts","../src/utils/aserror.ts","../src/utils/bindthis.ts","../src/utils/entries.ts","../src/utils/groupby.ts","../src/utils/iff.ts","../src/utils/indexby.ts","../src/utils/jsonclonedeep.ts","../src/utils/math.ts","../src/utils/noop.ts","../src/utils/omit.ts","../src/types/strings.ts","../src/utils/pad.ts","../src/utils/pluralize.ts","../src/utils/round.ts","../src/utils/sortby.ts","../src/async/cancelabledeferred.ts","../src/lazyasync.ts","../src/time/timeunit.ts","../src/time/timebase.ts","../src/time/types.ts","../src/time/timeinstantbuilder.ts","../src/time/timeinstant.ts","../src/logger.ts","../src/optional.ts","../src/time/randomtimeduration.ts","../src/time/timefrequency.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","../src/async/ratethrottler.ts","../src/async/semaphore.ts","../src/async/index.ts","../src/utils/throttle.ts","../src/utils/uniqby.ts","../src/utils/uniq.ts","../src/utils/uniqbykey.ts","../src/utils/withtrycatch.ts","../src/utils/withtrycatchasync.ts","../src/utils/wrap.ts","../src/utils/index.ts","../src/time/timeduration.ts","../src/types/promises.ts","../src/types/records.ts","../src/types/index.ts","../src/lazy.ts","../src/utils/upsert.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"710972dab6016ae9e74c1513276811dbf00f345c85efe27740f9f0977a374a5d","signature":"d6a90ccda7da792c44876fd0970a64091edb80a12a6cc4180b711359a16b6ad7"},{"version":"f7f78db9933db871fef76a88b2b3e9e4a55cfc8a1d10a57d094089eee4916112","signature":"2d0ac519b493abc8d75b554343855f640bebe392026a85c8011f2f7b55e0cde0"},{"version":"41a70337edbaebfb0fdd366ddf0816fefea5989c75bdffdbb9ff698256951c74","signature":"14ec40ede4588be7502237d1e7e701f90a6507417b6b98401f550bb12e2fbf55"},{"version":"3368ada33db31e713d715d379245783f2f83807f8bf451e8984d6cb9798006b8","signature":"3f9a02628d3942552af0db48dd1aec763a73f64e23b51b4c90b8698bb9e28a3e"},{"version":"6e81a5902f4aa66d5f23b7e5e0719142b460030946365085f20678cb22ba78d2","signature":"ab7ae87ac3f478b45407c86f5279125a3d7cc2b254a8695527d7cbfd13f1d4ce"},{"version":"1ab20f387ef7fa5cf94272900952596792f583f45bbd58d9adf2d623349d060e","signature":"ec49ec1ca3ddc1fbcdb45f1740ccd72d20fbf450036286c4373d9d13ddf2c4a2"},{"version":"0d578fa07b7e41030f7ad5176898a0a70a092fc45a264ce67498f63e544344e1","signature":"eb96292ecf52597cf826715047ec8411375f0ac8a43d0bd12f87dd3190838a04"},{"version":"0c2d31de31c722f2a2d217b0dd927ad459eaf7a088d1ffc53a1f082cb58f59f6","signature":"1f2802076d77a350fa013e69a8cbcdd819634d5f7cd410c4c647a436af39c5e3"},{"version":"56571c3f44c6312462e8395ed75d05887dcbcb1581a0ad47dd72bcdbb898ea84","signature":"853de26cb0c4a51d7b511bf303ff4d6680bc18d36b3f2f6d7b8008c8927b58a1"},{"version":"32d1cc98171225b1ea747e71c378c6f3047770698a4fb37aec8b98032efa0b37","signature":"3d6fc989ab9610df8f8dd2ebd81a166725150dbf29ee8a7ac864fe07a17e7ab1"},{"version":"7b64ad79eab8b8f6f7ba60ae55d44ef817385165ae3588c09fab650efcdc35da","signature":"33e73f88f0bd53d987b909847e6e5656c535a52b4e1062c867ea7f00fa681bf9"},{"version":"3155487a2925982e7752894e6d9f784489f51876b3e34a1634e7d6e32002a373","signature":"fd6665b27ab1c8457bf118b0ba61a501ddfab19ace7aa102ae11f173f98ca678"},{"version":"2d8a26fb3b5b1815c7073e91d1e6b98488dd92617ca04f5c70a26426bba59264","signature":"92cfe3b0878714459d8f4c46d1870cc0c1ced7f3726b5831560ee90bb52e6948"},{"version":"830cc95dc9e66f24fa3fb16e9eb1ccc2b6a082f8fb6479e523f24e8b4835061d","signature":"b52d36a910abd362550396a7ae3e970cc6360fb6599e08d0445290c6a0aadb90"},{"version":"20714847850a2d8390184047b6150784221d19ecf514a07c01fe7b40db0e62ab","signature":"46dcacf4f84ed7578dd5d15147953ffd6f17832c7a99d5bb66f9f7dc63784a6c"},{"version":"d32d4a1ac03938f3c9ac7bb44d658f153a54ec157133876e935200a19a556445","signature":"ecf709d0cad44f6b90e6008d5465bb4b75b588c3d57dd8885d22c0bcaa7c684a"},{"version":"c9be16daf6b334ccff7002c844eff5a6f5f8f406dd8ef9ae4059308b70f0c90b","signature":"d464231cd26c11d9ae98811b64266bbff099ba26f467e8ac8833cc2af2614ced"},{"version":"d2218597f31f96afc7b29b386697c93a94395fd616d905b863c3685c7547abd7","signature":"5907986ed181648bd0dbe28ab20ed531b6a8ba080199d9beab0a5973e3d25753"},{"version":"d1dc9203a262a1a20848a5c3b37e3929536a96aee6f128658ebd399a676ee88e","signature":"dfc54c72097f1526237c6f148d959587f6c3a6309db8c454fbb68bac92233e20"},{"version":"818fd4b3a3f948731d148152a80b5ae5e42cf5597a0c339830a0bb05d70ff686","signature":"a552668dda1fd06d526afb31afd8624c2fd2f0ecb65e4ffd8d27fbbf36f68468"},{"version":"bff44eee0154de48dd5202be47dd0d4c1cac773ef58296c89d312a4112a33772","signature":"42c9d1fa4c702692045f9d20d0fbea589a5255ec239d1a5f331902d9f9912a59"},{"version":"e04775f0e7743ace633a34fb715d42a80c85b5f92aa3eac8e83aff236c9020c3","signature":"a6952f6b1acfebcbc9d07e3d00e474531f0e98bed4e1c5e760dabe4d98f3d89d"},{"version":"115bd1440e08ba1115368f8e99e5371f837ed5dd4dfe5c11a0dabad03ede355c","signature":"a6632950be386e363cd24bc5f52f38bae67dd4ba0cb38a430d0ebf6c225d38b7"},{"version":"b862cbefe08dc2ac3b6806e7cf34230c9ace74fef0f6238aaf9528e1ef71827d","signature":"4bbaa921f498157fb3f9363c817ff16c414926f74bb935aab976e2bb56c1b84d"},{"version":"aec72d1243ed24d05cc8c1399b6ca2d709f478dc93fa2411c9373f422195610c","signature":"ceb685f7feca8029035f2028a681bfb25a33a81cb870f235c77bd1f1e48af2e5"},{"version":"68deaf2f260cd5857b1f45c1dc25a03b77c093ee08e3d1f587c6919927bbc990","signature":"8b33421a86e308df04613596fcb083a760872e0745c277011f4ad9672e3f227b"},{"version":"b36c59ff9135b3af0b65147146881dbc6d21dbb4b5857fc3ff0db4ae4d404d06","signature":"99ba7f0dfda819667065b7cd4323a5b4c82a05fb63922de358458cd368fb88b2"},{"version":"d41b2a6d9a8e1ee09e7953f93c261f3942d800f433023fc80668d447a6017a9f","signature":"e0a0f81b2fdf45f1211811255afafc322b7cc9e784ee465ac31f4abdde07e5a9"},{"version":"1b72e1f3724b04b5b19a7514ecfdb59445816ccde3d016cb77d70bd6fbaff6f8","signature":"a29a11ea1f06a29ebc9d88a8439d78598d2d4977115a70705902c117d2a19e76"},{"version":"dd16e4f177955dda7ff4d566808a315dcfd18cd0906da204d7efb47277286530","signature":"a3578bc3b767f260c900afed6813bd0f56c98a1216379749dd76202a4f2e4b14"},{"version":"18818ba8aeeafab2e39ce44fdbb46d1cce2b0b14f7231f8f6fa8a66384f389b1","signature":"fc47ef594e6a4c0675efed0d833eba33dc0dd8e9e6afe116332cb29a1bb58d1b"},{"version":"4c14e4a188a74583fea33c58b17fcd44b0536b9a09f9938a7fa0a4411cdf5722","signature":"d08bdc2df3b64a80c3870fcc3f1a802c1bbd88d9efaefe46bf5a7aeeb749b5ad"},{"version":"cb6e4d47248ad5cbeed78f4164cf996fb276d54a580ac52e3a7feb92c4336d77","signature":"86463269677354ddc223e39011b4b5f231cdc5d072d08fb0e4b431a915e1f6eb"},{"version":"88a4ce51deb93d98ee68f7237a8aaae8ea49e7aa3c3953daabdd79a26aff06d2","signature":"58686fcfd1c2f6e21d3dd7f52d347e73a9879aa634acd1baafe5f2c2e4c09e9a"},{"version":"67b4645f4fc756789696814e6e3c192a57a7e89b138d890442547b047417f148","signature":"13339d499ac59712315f756a08c00109fa86ddbdf0579d573a8526bcaf5e3700"},{"version":"fdfbcb1d437a70ef8653d5757156f0b19a476aac851dd78f67ad522242e4928a","signature":"626afa709798521c427847bb617e1379d22b90d6098118ce08e137383dab2965"},{"version":"e51ab8d52687a6c2d23dc513955a4b8cfea9288ea1ea81231358fc27f886ce20","signature":"d2e5010c7b6cda6257a079513c2fc232f3cf54d3daeb2df53e4231872e079dfc"},{"version":"aafa6811259f5f175367f3f482898789514aae6434e9ac911d0a9cd21b6b6269","signature":"d79d663e6b621d15b39aca1d448793fc2acee759e6e7c10f3432023972ddf007"},{"version":"140b8538a2c0cd54e0f007caf1f90c33a58594116fbf56a1f27f426afae5b36d","signature":"7daad2dae15c28accd363a5f69cad8ae2fa0ad110eadc6f319c4715a8bbb29aa"},{"version":"cc0e85ac3c026b4c42d865beaf4e4b6144fe9ff826657a844838879fda3dde6f","signature":"975d013c31f48ecb26867d0f98f13d2eaebb4af2bfbe6b5fd9a4d38fdccd5656"},{"version":"4cbaf1a0c6ef2813e50255154c26b68481478ec170c8999bfc1d4292d2e671da","signature":"11c308cc51acb6c9d4f5fcc77fba289bcaa0647477092fbbbd777cc0fd95d8cb"},{"version":"c3ab2d3bcd3acda91736013f2338127ecae65463a900647b522726454785b24d","signature":"c0d7f918c226764cc6a345557ebb59bfa4d72dd93b23dd3399b454474ce056f6"},{"version":"5b2927131599d55e0ee730c7a2afc764ff39199a5d186b510fc3eca82f4ef1ff","signature":"d6fc507f1c2ecd14c0882a0e00a1ba2a580c6e45550a3a5e868d7bee4b1922b6"},{"version":"9ef6e64d9f81af5e6e0a06b056fa74638a5e48ba3e5bdedc9d262148609dec43","signature":"ec5154c62fc54d4c9c9aac0d79c1a2e57cef6dddfe9f6ff9ae9933ce93350516"},{"version":"279b25dd44e5e11771ebc653f95380fdb60d0d0caf3df6cd4b6510700d25e1ce","signature":"deb20c0cf80a8512b23dacaaccff1a96f13056a57b4b329d8106e70987639f3e"},{"version":"685c56fb04c565cca70a3e9660c1db15b56125f0929e9e1c8651071b1625ca4a","signature":"9ba1e380251d5b6c73fc0ef3c153f691e963c36cca9e2ba61864b24246791a0c"},{"version":"22577c900676846354224462f8a6b3e0e5033cd14a501ea46107e67a4ab7863f","signature":"70fd81e903686acf6e994565edb1588cc619b816646ea1a89ac9a47b45d25737"},{"version":"4e92eb4d4fa5bd21987ba473e0054d0393184ec9a33b351ffa4dbcef5fb9ecc3","signature":"ab815d46f9952bd31fc7602ab41ef6fdfcaef4b7dd3cd4c7557a75c52fd9001c"},{"version":"de9892afb7f873f59777bccfb79600799e79399d3f5000a9c36e428b8d6f9e3c","signature":"c25a63b006ce54b05918dc5df4650a4b72580eef3ef3e889fdaba83925dfb367"},{"version":"a4cb5065d57197fb7b342b20282fd75d5196e5ea50cf07b0644a96629c7a0480","signature":"522645ec1ae54b25f88a6ec7acc684b638483ccd19e4dca248931b8fdb94a18c"},{"version":"1d0ec7969ec2b4b1bec65e7924b5f64d3dd0c39dba60a6c65d6a301589bf6e76","signature":"86122f878833e22a38a54656b9fe61736ba6c103b6a2fa01dae70458aec4353d"},{"version":"60f9a401c5109b96a9d833d5676a78afef722f974119b6a353dafb2d260c0fb3","signature":"a83bb6c06a593ff08f3f92127360478f9088d84473f12d971fe69595d0ac237d"},{"version":"68c2ad396b93b1c5d39c3d2fc221fac5db3a79687d000ab8a3595b92eb28927c","signature":"217bd1741b991da9879e53c23ad81eeca2c7316d13ae177727e531704c13dce3"},{"version":"33d51bd6a2bdc9a2fc5c80e1c459c3c597ee98ab02fb52d8dd1acd89161ed6e6","signature":"a335f0f94e1c439bfe040fa754d093ecf6beb6357a4da1db70ffa188dc4415dd"},{"version":"4632c48d8d0bbb103a5594c6ea37eb345e884e7c11da3f7c341a4e944ef2d3dc","signature":"4ffb82aa0d7f0e2079d4c08f3fbb390bc6ee370f289216dab37a31ea748ee18d"},{"version":"d25c0065d7871c9dd0ece7c01aef726eaaced9f67ff10d5528d4872764b81ffa","signature":"2d7b8c35d9f482db0f39d60ce9ff6717149e22acbdfa87b30def9cecb2e66b5d"},{"version":"0c09691edb10e12b21a0705bab47ad712306a5bcf0714514545489bf876cef4a","signature":"afbee399954c8db6614dddb0e0a16b02e72a0a44995f8e69d82c34f4215cc06a"},{"version":"cbc0f868094b3915e03e854f3ecdd83a8b8bdc4a2b4a4952ab3fcaa05227a9c4","signature":"ac7c8f5bf90bc90b3d5a938a0d83f118f17a53cd68d48f17a61ef0e1054c4bae"},{"version":"6efc963070c16ffbab1f6b05778eb581188d8ba4fedbdae94cd744c34260236e","signature":"9a61e6e2d59f0a6268b21f587741519f9fdee6e970c7bf9553bc11378bc64eea"},{"version":"c6505ebb6a549d99595bcabb6f3bdd7aebd8122b495866a2022418943e366544","signature":"d5672aad98abdd649fe984de0676032bccb9baf697c1714987b2647a818ae897"},{"version":"d3816328a097970f46726b8e2f34f1e66fab2d95a2463fe0a3a3460308fc06aa","signature":"0cce1783c4c412541b1118f66a401ee1076d2b45f6de005ffa10d7a3138bdbc3"},{"version":"9e76484f48fec7c4a847c991843a325918216e773d5b2159df76b543b602560c","signature":"3b349d96bd6b1e310928928bc5494dd96d57f15033223fdec867c95eb70d327e"},{"version":"f986efc048f3a0f73e094e121d297d5dcd5fadaaa3c81ae71a5df60ce2be24d6","signature":"341f9956850dff2e7d08a2fe99a69b2300b105ad74d358164056c15899d05e11"},{"version":"9d436df13ce6e1aeb2fd98bf9ec67aebd51e6e59bc14392c83f449c952527295","signature":"c5c9b67f95b65ea2c92336169a4f48b1033a9c4ac73c3acbc5d691a73dc688e8"},{"version":"dba5166ad9db9ba648c1032ebbd34dcd0d085b50023b839ef5c68ca1db93a563","signature":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}],"root":[[59,123]],"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"},"fileIdsList":[[70],[59],[70,89,107,108],[70,99,106],[70,106],[64,73,90,96,97,100,105,109,117,121,122],[121],[65],[82,95],[59,65],[71,72],[71],[60,61,121],[60,62,63],[91,93,95,98,99,118],[71,91,118],[91],[64,70,73,91,92,95,117,121],[118,121],[64,70,91,92,93,94,117,118,121],[59,65,93,95],[59,64,65],[59,65,66,67,68,69,84,119,120],[59,118],[65,66],[101,102,103,117,121],[102,121],[102,104],[61,74,75,76,77,78,79,80,81,82,83,85,86,87,88,110,111,112,113,114,115,116],[66],[65,84],[99,109,121],[61,111],[111],[74,121]],"referencedMap":[[89,1],[70,2],[109,3],[107,4],[108,5],[106,6],[122,7],[90,8],[96,9],[97,10],[73,11],[72,12],[62,13],[64,14],[63,13],[60,2],[100,15],[98,16],[92,17],[118,18],[99,19],[95,20],[94,21],[93,7],[66,22],[121,23],[65,2],[69,2],[119,24],[84,25],[104,26],[103,27],[105,28],[102,7],[76,7],[77,7],[78,7],[117,29],[79,7],[80,7],[81,30],[83,7],[85,31],[88,7],[110,32],[112,33],[111,7],[113,34],[114,35],[115,35]],"latestChangedDtsFile":"./Optional.d.ts"},"version":"5.5.4"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TComparisonFunction } from "../sorting/index.js";
|
|
2
|
+
import { TBiPredicate } from "./functions.js";
|
|
3
|
+
import { TMaybe } from "./nulls.js";
|
|
4
|
+
export type TReadableArray<T> = Array<T> | ReadonlyArray<T>;
|
|
5
|
+
export type TArrayable<T> = T | T[];
|
|
6
|
+
export type TEmptyArray = [];
|
|
7
|
+
export declare function ensureArray<const T>(t: T | Array<T>): Array<T>;
|
|
8
|
+
export declare function ensureReadableArray<const T>(t: T | Array<T> | ReadonlyArray<T>): TReadableArray<T>;
|
|
9
|
+
export declare function isArray<const T>(t: unknown): t is Array<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Generate a new copy of an array with:
|
|
12
|
+
* - the first instance of an item matching the predicate being replaced with the given argument
|
|
13
|
+
* - the given argument added as last item of the array if the predicate did not produce a match
|
|
14
|
+
* @param arr - the original array of items
|
|
15
|
+
* @param item - the item to insert or update
|
|
16
|
+
* @param predicate - a function that returns true iff an item is equal to the given argument
|
|
17
|
+
* @returns a new copy of the array with the item updated or added in last place
|
|
18
|
+
*/
|
|
19
|
+
export declare function upsert<T>(arr: ReadonlyArray<T>, item: T, isEqual: TBiPredicate<T>): Array<T>;
|
|
20
|
+
export declare function range(start: number, end: number): Array<number>;
|
|
21
|
+
export declare function fill<T>(length: number, value: T): Array<T>;
|
|
22
|
+
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)>;
|
|
23
|
+
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)>;
|
|
24
|
+
export declare function reverse<T>(arr: TReadableArray<T>): Array<T>;
|
|
25
|
+
export declare function head<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
|
|
26
|
+
export declare function last<T>(arr: TReadableArray<T>, defaultValue?: TMaybe<T>): TMaybe<T>;
|
|
27
|
+
export declare function sortedArray<T>(arr: Array<T>, sortFn?: TComparisonFunction<T> | undefined): Array<T>;
|
|
28
|
+
export declare function sortedArray<T>(arr: ReadonlyArray<T>, sortFn?: TComparisonFunction<T> | undefined): ReadonlyArray<T>;
|
|
29
|
+
/**
|
|
30
|
+
* Custom implementation of includes which allows checking for arbitrary items inside the array.
|
|
31
|
+
*/
|
|
32
|
+
export declare function includes<T>(arr: TReadableArray<T>, item: unknown, fromIndex?: number): boolean;
|
|
33
|
+
export declare function filterTruthy<T>(arr: TReadableArray<T | false>): TReadableArray<T>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type TFunction<A, R> = (a: A) => R;
|
|
2
|
+
export type TVoidFunction = TFunction<void, void>;
|
|
3
|
+
export type TProducer<R> = TFunction<void, R>;
|
|
4
|
+
export type TConsumer<T> = TFunction<T, void>;
|
|
5
|
+
export type TPredicate<T> = TFunction<T, boolean>;
|
|
6
|
+
export type TIdentityFunction<T> = TFunction<T, T>;
|
|
7
|
+
export type TBiFunction<A, B, R> = (a: A, b: B) => R;
|
|
8
|
+
export type TBiConsumer<A, B> = TBiFunction<A, B, void>;
|
|
9
|
+
export type TBiPredicate<T> = TBiFunction<T, T, boolean>;
|
|
10
|
+
export type TAsyncFunction<A, R> = TFunction<A, Promise<R>>;
|
|
11
|
+
export type TAsyncVoidFunction = TAsyncFunction<void, void>;
|
|
12
|
+
export type TAsyncProducer<R> = TAsyncFunction<void, R>;
|
|
13
|
+
export type TAsyncConsumer<T> = TAsyncFunction<T, void>;
|
|
14
|
+
export type TAsyncPredicate<T> = TAsyncFunction<T, boolean>;
|
|
15
|
+
export type TAsyncBiFunction<A, B, R> = TBiFunction<A, B, Promise<R>>;
|
|
16
|
+
export type TAsyncBiConsumer<A, B> = TAsyncBiFunction<A, B, void>;
|
|
17
|
+
export type TAsyncBiPredicate<T> = TAsyncBiFunction<T, T, boolean>;
|
|
18
|
+
export type TAnyFunction<R> = (...args: unknown[]) => R;
|
|
19
|
+
export type TAsyncAnyFunction<R> = (...args: unknown[]) => Promise<R>;
|
|
20
|
+
export declare function isFunction(t: unknown): t is Function;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type TTimeoutHandle = ReturnType<typeof setTimeout>;
|
|
2
|
+
export type TIntervalHandle = ReturnType<typeof setInterval>;
|
|
3
|
+
export type TPrimitive = string | number | boolean | null;
|
|
4
|
+
export * from './arrays';
|
|
5
|
+
export * from './booleans.ts';
|
|
6
|
+
export * from './functions';
|
|
7
|
+
export * from './json';
|
|
8
|
+
export * from './nulls';
|
|
9
|
+
export * from './numbers';
|
|
10
|
+
export * from './promises';
|
|
11
|
+
export * from './records';
|
|
12
|
+
export * from './strings';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type TJsonPrimitive = string | number | boolean | null | undefined;
|
|
2
|
+
export type TJsonArray = Array<TJsonSerializable> | ReadonlyArray<TJsonSerializable>;
|
|
3
|
+
export type TJsonObject = {
|
|
4
|
+
[key: string]: TJsonSerializable;
|
|
5
|
+
};
|
|
6
|
+
export type TJsonSerializable = TJsonPrimitive | TJsonArray | TJsonObject;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TConsumer, TFunction } from "./functions.js";
|
|
2
|
+
export type TMaybe<T> = T | null;
|
|
3
|
+
export declare function ensureDefined<T>(v: T, name?: string): T;
|
|
4
|
+
export declare function isDefined<T>(x: T | null | undefined): x is T;
|
|
5
|
+
export declare function isNullOrUndefined(x: unknown): x is null | undefined;
|
|
6
|
+
export declare function ifDefined<R>(source: TMaybe<R>, callback: TConsumer<R>): void;
|
|
7
|
+
export declare function mapDefined<R, S>(source: TMaybe<R>, mapper: TFunction<R, S>): TMaybe<S>;
|
|
8
|
+
export declare function ifNullOrUndefined(source: TMaybe<unknown>, callback: TConsumer<void>): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { TFunction } from "./functions.js";
|
|
2
|
+
export type TNumericString = `${number}`;
|
|
3
|
+
export type TNumericFloatingPointString = `${number}.${number}`;
|
|
4
|
+
export type TPositiveNumber = number;
|
|
5
|
+
export type TNegativeNumber = number;
|
|
6
|
+
export type TZero = 0;
|
|
7
|
+
export type TDigit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
8
|
+
export type TDigit1_9 = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
|
9
|
+
export 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;
|
|
10
|
+
export 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;
|
|
11
|
+
export type TNumber0_5 = 0 | 1 | 2 | 3 | 4 | 5;
|
|
12
|
+
export type TNumber0_10 = TNumber0_5 | 6 | 7 | 8 | 9 | 10;
|
|
13
|
+
export type TNumber0_15 = TNumber0_10 | 11 | 12 | 13 | 14 | 15;
|
|
14
|
+
export type TNumber0_20 = TNumber0_15 | 16 | 17 | 18 | 19 | 20;
|
|
15
|
+
export type TNumber1_10 = Exclude<TNumber0_10, 0>;
|
|
16
|
+
export type TParseInt<T> = T extends `${infer N extends number}` ? N : never;
|
|
17
|
+
export type TParseableInt<T> = T extends `${number}` ? T : never;
|
|
18
|
+
export declare function ensurePositiveNumber(v: number, name?: string): number;
|
|
19
|
+
export declare function ensureNonNegativeNumber(v: number, name?: string): number;
|
|
20
|
+
export declare function ensureNonPositiveNumber(v: number, name?: string): number;
|
|
21
|
+
export declare function ensureNegativeNumber(v: number, name?: string): number;
|
|
22
|
+
export declare function incrementBy(n: number): TFunction<number, number>;
|
|
23
|
+
export declare function multiplyBy(n: number): TFunction<number, number>;
|
|
24
|
+
export declare function divideBy(n: number): TFunction<number, number>;
|
|
25
|
+
export declare const increment: TFunction<number, number>;
|
|
26
|
+
export declare const decrement: TFunction<number, number>;
|
|
27
|
+
export declare const decrementBy: (n: number) => TFunction<number, number>;
|
|
28
|
+
export declare function isNumber(v: unknown): v is number;
|
|
29
|
+
export declare function isPositiveNumber(v: number): v is TPositiveNumber;
|
|
30
|
+
export declare function isNegativeNumber(v: number): v is TNegativeNumber;
|
|
31
|
+
export declare function isZero(v: number): v is TZero;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import TimeDuration from "../time/TimeDuration.js";
|
|
2
|
+
import { TAsyncFunction, TFunction } from "./functions.js";
|
|
3
|
+
export type TPromisable<T> = T | Promise<T>;
|
|
4
|
+
export declare function asPromise<T>(promisable: TPromisable<T>): Promise<T>;
|
|
5
|
+
export declare function promiseSequence<R>(...fns: TFunction<void, Promise<R>>[]): TFunction<void, Promise<R[]>>;
|
|
6
|
+
export declare function delayPromise<T>(duration: TimeDuration): TAsyncFunction<T, T>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type TEmpty = Record<string, never>;
|
|
2
|
+
export type TKeysOfType<T, V> = {
|
|
3
|
+
[K in keyof T]-?: T[K] extends V ? K : never;
|
|
4
|
+
}[keyof T];
|
|
5
|
+
export declare function dictToList<T>(obj: Record<string | number, T>): T[];
|
|
6
|
+
export declare function pick<T extends object, K extends keyof T>(o: T, keys: K[]): Pick<T, K>;
|
|
7
|
+
export type TOptionsWithoutDefaults<T, R> = Partial<T> & Required<Omit<T, keyof R>>;
|
|
8
|
+
export type TOptionalKeysForType<T> = {
|
|
9
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? K : never;
|
|
10
|
+
}[keyof T];
|
|
11
|
+
export type TRequiredKeysForType<T> = Exclude<keyof T, TOptionalKeysForType<T>>;
|
|
12
|
+
export type TAllKeysOptional<T> = TRequiredKeysForType<T> extends never ? true : false;
|
|
13
|
+
export type TConditionalParameter<T> = TAllKeysOptional<T> extends true ? T | undefined : T;
|
|
14
|
+
export type TConditionalParameterOptions<T, R> = TConditionalParameter<TOptionsWithoutDefaults<T, R>>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TReadableArray } from "./arrays.js";
|
|
2
|
+
import { TMaybe } from "./nulls.js";
|
|
3
|
+
export type THtmlString = string;
|
|
4
|
+
export type TUrl = string;
|
|
5
|
+
export type TRelativeUrl = string;
|
|
6
|
+
export declare function hashCode(str: string): number;
|
|
7
|
+
export declare function repeat(char: string, times: number): string;
|
|
8
|
+
export declare function capitalizeWord(word: string): string;
|
|
9
|
+
export declare function splitWords(text: string, regEx?: RegExp): string[];
|
|
10
|
+
export declare function stringToNumber(s: string | null | undefined): number | null;
|
|
11
|
+
export declare class StringParts {
|
|
12
|
+
private readonly _parts;
|
|
13
|
+
private constructor();
|
|
14
|
+
toUpperCase(): StringParts;
|
|
15
|
+
toLowerCase(): StringParts;
|
|
16
|
+
capitalizeFirst(): StringParts;
|
|
17
|
+
capitalizeEach(): StringParts;
|
|
18
|
+
get parts(): string[];
|
|
19
|
+
get tail(): string[];
|
|
20
|
+
get first(): TMaybe<string>;
|
|
21
|
+
get last(): TMaybe<string>;
|
|
22
|
+
get length(): number;
|
|
23
|
+
trim(): StringParts;
|
|
24
|
+
toSnakeCase(): string;
|
|
25
|
+
toCamelCase(): string;
|
|
26
|
+
toKebabCase(): string;
|
|
27
|
+
toPascalCase(): string;
|
|
28
|
+
toHumanCase(): string;
|
|
29
|
+
join(separator: string): string;
|
|
30
|
+
mergeWith({ parts: otherParts }: {
|
|
31
|
+
parts: TReadableArray<string>;
|
|
32
|
+
}): StringParts;
|
|
33
|
+
slice(start: number, end?: number): StringParts;
|
|
34
|
+
splice(start: number, deleteCount: number, ...items: string[]): StringParts;
|
|
35
|
+
push(part: string): StringParts;
|
|
36
|
+
shift(part: string): StringParts;
|
|
37
|
+
reverse(): StringParts;
|
|
38
|
+
static fromString: (s: string, separator?: string | RegExp) => StringParts;
|
|
39
|
+
static fromParts: (...parts: string[]) => StringParts;
|
|
40
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TJsonSerializable } from "../types/index.ts";
|
|
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 "../types";
|
|
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 "../types";
|
|
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
|
+
}>;
|