@aneuhold/core-ts-lib 2.0.6 → 2.0.8
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/lib/services/DateService/DateService.d.ts +77 -3
- package/lib/services/DateService/DateService.d.ts.map +1 -1
- package/lib/services/DateService/DateService.js +77 -3
- package/lib/services/DateService/DateService.js.map +1 -1
- package/lib/services/DateService/DateService.ts +77 -3
- package/lib/services/DependencyService.d.ts +1 -0
- package/lib/services/DependencyService.d.ts.map +1 -1
- package/lib/services/DependencyService.js +1 -0
- package/lib/services/DependencyService.js.map +1 -1
- package/lib/services/DependencyService.ts +1 -0
- package/lib/utils/ErrorUtils.d.ts +10 -1
- package/lib/utils/ErrorUtils.d.ts.map +1 -1
- package/lib/utils/ErrorUtils.js +10 -1
- package/lib/utils/ErrorUtils.js.map +1 -1
- package/lib/utils/ErrorUtils.ts +10 -1
- package/lib/utils/Logger.d.ts +27 -3
- package/lib/utils/Logger.d.ts.map +1 -1
- package/lib/utils/Logger.js +27 -3
- package/lib/utils/Logger.js.map +1 -1
- package/lib/utils/Logger.ts +27 -3
- package/package.json +8 -8
|
@@ -10,29 +10,70 @@ export default class DateService {
|
|
|
10
10
|
/**
|
|
11
11
|
* Gets the date in date format if it is set to midnight, otherwise gets the
|
|
12
12
|
* date in date time format.
|
|
13
|
+
*
|
|
14
|
+
* @param date - The date to format.
|
|
15
|
+
* @returns The formatted date string.
|
|
13
16
|
*/
|
|
14
17
|
static getAutoDateString(date: Date): string;
|
|
15
18
|
/**
|
|
16
19
|
* Determines if a date has a user-specified time component to it, meaning
|
|
17
20
|
* that it isn't midnight.
|
|
21
|
+
*
|
|
22
|
+
* @param date - The date to check.
|
|
23
|
+
* @returns True if the date has a time component, false if it is midnight.
|
|
18
24
|
*/
|
|
19
25
|
static dateHasTime(date: Date): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Formats the date as a string.
|
|
28
|
+
*
|
|
29
|
+
* @param date - The date to format.
|
|
30
|
+
* @returns The formatted date string.
|
|
31
|
+
*/
|
|
20
32
|
static getDateString(date: Date): string;
|
|
33
|
+
/**
|
|
34
|
+
* Formats the date and time as a string.
|
|
35
|
+
*
|
|
36
|
+
* @param date - The date to format.
|
|
37
|
+
* @returns The formatted date and time string.
|
|
38
|
+
*/
|
|
21
39
|
static getDateTimeString(date: Date): string;
|
|
22
40
|
/**
|
|
23
41
|
* Determines if two dates are equal. This is strict, down to the ms.
|
|
42
|
+
*
|
|
43
|
+
* @param date1 - The first date to compare.
|
|
44
|
+
* @param date2 - The second date to compare.
|
|
45
|
+
* @returns True if the dates are equal, false otherwise.
|
|
24
46
|
*/
|
|
25
47
|
static datesAreEqual(date1: Date | undefined | null, date2: Date | undefined | null): boolean;
|
|
26
48
|
/**
|
|
27
49
|
* Gets the last day of the month for the provided date. This will retain the
|
|
28
50
|
* time that was provided in the date.
|
|
51
|
+
*
|
|
52
|
+
* @param date - The date to get the last day of the month for.
|
|
53
|
+
* @returns The last day of the month.
|
|
29
54
|
*/
|
|
30
55
|
static getLastDayOfGivenMonth(date: Date): Date;
|
|
31
56
|
/**
|
|
32
57
|
* Gets the week of the month for the provided date. This starts at 1.
|
|
58
|
+
*
|
|
59
|
+
* @param date - The date to get the week of the month for.
|
|
60
|
+
* @returns The week of the month.
|
|
33
61
|
*/
|
|
34
62
|
static getWeekOfMonth(date: Date): number;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the last week of the month for the provided date.
|
|
65
|
+
*
|
|
66
|
+
* @param date - The date to get the last week of the month for.
|
|
67
|
+
* @returns The last week of the month.
|
|
68
|
+
*/
|
|
35
69
|
static getLastWeekOfMonth(date: Date): number;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the number of days until the specified weekday.
|
|
72
|
+
*
|
|
73
|
+
* @param date - The date to start from.
|
|
74
|
+
* @param day - The weekday to get the number of days until.
|
|
75
|
+
* @returns The number of days until the specified weekday.
|
|
76
|
+
*/
|
|
36
77
|
static getDaysUntilWeekDay(date: Date, day: number): number;
|
|
37
78
|
/**
|
|
38
79
|
* Gets the date of the provided weekday in the provided week of the month.
|
|
@@ -40,28 +81,61 @@ export default class DateService {
|
|
|
40
81
|
*
|
|
41
82
|
* For example, the 2nd Monday of the month, or the last Saturday of the
|
|
42
83
|
* month.
|
|
84
|
+
*
|
|
85
|
+
* @param date - The date to start from.
|
|
86
|
+
* @param day - The weekday to get the date for.
|
|
87
|
+
* @param week - The week of the month to get the date for.
|
|
88
|
+
* @returns The date of the specified weekday in the specified week of the month.
|
|
43
89
|
*/
|
|
44
90
|
static getWeekDayOfXWeekOfMonth(date: Date, day: number, week: number | 'last'): Date | null;
|
|
45
91
|
/**
|
|
46
92
|
* Adds the provided number of days to the provided date. If the days are
|
|
47
93
|
* over or under the number of days in the month, then the month will be
|
|
48
94
|
* adjusted accordingly.
|
|
95
|
+
*
|
|
96
|
+
* @param date - The date to add days to.
|
|
97
|
+
* @param days - The number of days to add.
|
|
98
|
+
* @returns The new date with the added days.
|
|
49
99
|
*/
|
|
50
100
|
static addDays(date: Date, days: number): Date;
|
|
101
|
+
/**
|
|
102
|
+
* Adds the provided number of months to the provided date.
|
|
103
|
+
*
|
|
104
|
+
* @param date - The date to add months to.
|
|
105
|
+
* @param months - The number of months to add.
|
|
106
|
+
* @returns The new date with the added months.
|
|
107
|
+
*/
|
|
51
108
|
static addMonths(date: Date, months: number): Date;
|
|
109
|
+
/**
|
|
110
|
+
* Adds the provided number of weeks to the provided date.
|
|
111
|
+
*
|
|
112
|
+
* @param date - The date to add weeks to.
|
|
113
|
+
* @param weeks - The number of weeks to add.
|
|
114
|
+
* @returns The new date with the added weeks.
|
|
115
|
+
*/
|
|
52
116
|
static addWeeks(date: Date, weeks: number): Date;
|
|
117
|
+
/**
|
|
118
|
+
* Adds the provided number of years to the provided date.
|
|
119
|
+
*
|
|
120
|
+
* @param date - The date to add years to.
|
|
121
|
+
* @param years - The number of years to add.
|
|
122
|
+
* @returns The new date with the added years.
|
|
123
|
+
*/
|
|
53
124
|
static addYears(date: Date, years: number): Date;
|
|
54
125
|
/**
|
|
55
126
|
* For personal projects, midnight can mean exactly midnight, or 11:59pm.
|
|
56
127
|
* It acts as a border between two dates.
|
|
128
|
+
*
|
|
129
|
+
* @param date - The date to check.
|
|
130
|
+
* @returns True if the date is midnight, false otherwise.
|
|
57
131
|
*/
|
|
58
132
|
static dateIsMidnight(date: Date): boolean;
|
|
59
133
|
/**
|
|
60
134
|
* Determines if the dates are on the same day.
|
|
61
135
|
*
|
|
62
|
-
* @param first
|
|
63
|
-
* @param second
|
|
64
|
-
* @returns
|
|
136
|
+
* @param first - The first date.
|
|
137
|
+
* @param second - The second date.
|
|
138
|
+
* @returns True if they are on the same day, false otherwise.
|
|
65
139
|
*/
|
|
66
140
|
static datesAreOnSameDay(first: Date, second: Date): boolean;
|
|
67
141
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateService.d.ts","sourceRoot":"./src/","sources":["services/DateService/DateService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,MAAM,CAAC,aAAa,CAIzB;IAEH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAM7B;IAEH
|
|
1
|
+
{"version":3,"file":"DateService.d.ts","sourceRoot":"./src/","sources":["services/DateService/DateService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,MAAM,CAAC,aAAa,CAIzB;IAEH,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAM7B;IAEH;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;IAO5C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAIvC;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,GA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O;IAO1C;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO;CAO7D"}
|
|
@@ -20,6 +20,9 @@ export default class DateService {
|
|
|
20
20
|
/**
|
|
21
21
|
* Gets the date in date format if it is set to midnight, otherwise gets the
|
|
22
22
|
* date in date time format.
|
|
23
|
+
*
|
|
24
|
+
* @param date - The date to format.
|
|
25
|
+
* @returns The formatted date string.
|
|
23
26
|
*/
|
|
24
27
|
static getAutoDateString(date) {
|
|
25
28
|
if (this.dateHasTime(date)) {
|
|
@@ -30,18 +33,37 @@ export default class DateService {
|
|
|
30
33
|
/**
|
|
31
34
|
* Determines if a date has a user-specified time component to it, meaning
|
|
32
35
|
* that it isn't midnight.
|
|
36
|
+
*
|
|
37
|
+
* @param date - The date to check.
|
|
38
|
+
* @returns True if the date has a time component, false if it is midnight.
|
|
33
39
|
*/
|
|
34
40
|
static dateHasTime(date) {
|
|
35
41
|
return !this.dateIsMidnight(date);
|
|
36
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Formats the date as a string.
|
|
45
|
+
*
|
|
46
|
+
* @param date - The date to format.
|
|
47
|
+
* @returns The formatted date string.
|
|
48
|
+
*/
|
|
37
49
|
static getDateString(date) {
|
|
38
50
|
return this.dateFormatter.format(date);
|
|
39
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* Formats the date and time as a string.
|
|
54
|
+
*
|
|
55
|
+
* @param date - The date to format.
|
|
56
|
+
* @returns The formatted date and time string.
|
|
57
|
+
*/
|
|
40
58
|
static getDateTimeString(date) {
|
|
41
59
|
return this.dateTimeFormatter.format(date);
|
|
42
60
|
}
|
|
43
61
|
/**
|
|
44
62
|
* Determines if two dates are equal. This is strict, down to the ms.
|
|
63
|
+
*
|
|
64
|
+
* @param date1 - The first date to compare.
|
|
65
|
+
* @param date2 - The second date to compare.
|
|
66
|
+
* @returns True if the dates are equal, false otherwise.
|
|
45
67
|
*/
|
|
46
68
|
static datesAreEqual(date1, date2) {
|
|
47
69
|
if (!date1 && !date2) {
|
|
@@ -55,6 +77,9 @@ export default class DateService {
|
|
|
55
77
|
/**
|
|
56
78
|
* Gets the last day of the month for the provided date. This will retain the
|
|
57
79
|
* time that was provided in the date.
|
|
80
|
+
*
|
|
81
|
+
* @param date - The date to get the last day of the month for.
|
|
82
|
+
* @returns The last day of the month.
|
|
58
83
|
*/
|
|
59
84
|
static getLastDayOfGivenMonth(date) {
|
|
60
85
|
// Setting the day to 0, makes the date move to the last day of the
|
|
@@ -66,6 +91,9 @@ export default class DateService {
|
|
|
66
91
|
}
|
|
67
92
|
/**
|
|
68
93
|
* Gets the week of the month for the provided date. This starts at 1.
|
|
94
|
+
*
|
|
95
|
+
* @param date - The date to get the week of the month for.
|
|
96
|
+
* @returns The week of the month.
|
|
69
97
|
*/
|
|
70
98
|
static getWeekOfMonth(date) {
|
|
71
99
|
const firstDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
@@ -80,10 +108,23 @@ export default class DateService {
|
|
|
80
108
|
const weeksSinceFirstDayOfSecondWeek = Math.floor(daysSinceFirstDayOfSecondWeek / 7);
|
|
81
109
|
return weeksSinceFirstDayOfSecondWeek + 2;
|
|
82
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Gets the last week of the month for the provided date.
|
|
113
|
+
*
|
|
114
|
+
* @param date - The date to get the last week of the month for.
|
|
115
|
+
* @returns The last week of the month.
|
|
116
|
+
*/
|
|
83
117
|
static getLastWeekOfMonth(date) {
|
|
84
118
|
const lastDayOfMonth = this.getLastDayOfGivenMonth(date);
|
|
85
119
|
return this.getWeekOfMonth(lastDayOfMonth);
|
|
86
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Gets the number of days until the specified weekday.
|
|
123
|
+
*
|
|
124
|
+
* @param date - The date to start from.
|
|
125
|
+
* @param day - The weekday to get the number of days until.
|
|
126
|
+
* @returns The number of days until the specified weekday.
|
|
127
|
+
*/
|
|
87
128
|
static getDaysUntilWeekDay(date, day) {
|
|
88
129
|
const daysUntilWeekDay = day - date.getDay();
|
|
89
130
|
if (daysUntilWeekDay < 0) {
|
|
@@ -97,6 +138,11 @@ export default class DateService {
|
|
|
97
138
|
*
|
|
98
139
|
* For example, the 2nd Monday of the month, or the last Saturday of the
|
|
99
140
|
* month.
|
|
141
|
+
*
|
|
142
|
+
* @param date - The date to start from.
|
|
143
|
+
* @param day - The weekday to get the date for.
|
|
144
|
+
* @param week - The week of the month to get the date for.
|
|
145
|
+
* @returns The date of the specified weekday in the specified week of the month.
|
|
100
146
|
*/
|
|
101
147
|
static getWeekDayOfXWeekOfMonth(date, day, week) {
|
|
102
148
|
if ((typeof week === 'number' && (week < 1 || week > 5)) ||
|
|
@@ -130,20 +176,45 @@ export default class DateService {
|
|
|
130
176
|
* Adds the provided number of days to the provided date. If the days are
|
|
131
177
|
* over or under the number of days in the month, then the month will be
|
|
132
178
|
* adjusted accordingly.
|
|
179
|
+
*
|
|
180
|
+
* @param date - The date to add days to.
|
|
181
|
+
* @param days - The number of days to add.
|
|
182
|
+
* @returns The new date with the added days.
|
|
133
183
|
*/
|
|
134
184
|
static addDays(date, days) {
|
|
135
185
|
const newDate = new Date(date);
|
|
136
186
|
newDate.setDate(newDate.getDate() + days);
|
|
137
187
|
return newDate;
|
|
138
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Adds the provided number of months to the provided date.
|
|
191
|
+
*
|
|
192
|
+
* @param date - The date to add months to.
|
|
193
|
+
* @param months - The number of months to add.
|
|
194
|
+
* @returns The new date with the added months.
|
|
195
|
+
*/
|
|
139
196
|
static addMonths(date, months) {
|
|
140
197
|
const newDate = new Date(date);
|
|
141
198
|
newDate.setMonth(newDate.getMonth() + months);
|
|
142
199
|
return newDate;
|
|
143
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Adds the provided number of weeks to the provided date.
|
|
203
|
+
*
|
|
204
|
+
* @param date - The date to add weeks to.
|
|
205
|
+
* @param weeks - The number of weeks to add.
|
|
206
|
+
* @returns The new date with the added weeks.
|
|
207
|
+
*/
|
|
144
208
|
static addWeeks(date, weeks) {
|
|
145
209
|
return this.addDays(date, weeks * 7);
|
|
146
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Adds the provided number of years to the provided date.
|
|
213
|
+
*
|
|
214
|
+
* @param date - The date to add years to.
|
|
215
|
+
* @param years - The number of years to add.
|
|
216
|
+
* @returns The new date with the added years.
|
|
217
|
+
*/
|
|
147
218
|
static addYears(date, years) {
|
|
148
219
|
const newDate = new Date(date);
|
|
149
220
|
newDate.setFullYear(newDate.getFullYear() + years);
|
|
@@ -152,6 +223,9 @@ export default class DateService {
|
|
|
152
223
|
/**
|
|
153
224
|
* For personal projects, midnight can mean exactly midnight, or 11:59pm.
|
|
154
225
|
* It acts as a border between two dates.
|
|
226
|
+
*
|
|
227
|
+
* @param date - The date to check.
|
|
228
|
+
* @returns True if the date is midnight, false otherwise.
|
|
155
229
|
*/
|
|
156
230
|
static dateIsMidnight(date) {
|
|
157
231
|
return ((date.getHours() === 0 && date.getMinutes() === 0) ||
|
|
@@ -160,9 +234,9 @@ export default class DateService {
|
|
|
160
234
|
/**
|
|
161
235
|
* Determines if the dates are on the same day.
|
|
162
236
|
*
|
|
163
|
-
* @param first
|
|
164
|
-
* @param second
|
|
165
|
-
* @returns
|
|
237
|
+
* @param first - The first date.
|
|
238
|
+
* @param second - The second date.
|
|
239
|
+
* @returns True if they are on the same day, false otherwise.
|
|
166
240
|
*/
|
|
167
241
|
static datesAreOnSameDay(first, second) {
|
|
168
242
|
return (first.getFullYear() === second.getFullYear() &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateService.js","sourceRoot":"./src/","sources":["services/DateService/DateService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IACtB,MAAM,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC9D,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEK,MAAM,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAClE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH
|
|
1
|
+
{"version":3,"file":"DateService.js","sourceRoot":"./src/","sources":["services/DateService/DateService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IACtB,MAAM,CAAC,aAAa,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAC9D,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;KACf,CAAC,CAAC;IAEK,MAAM,CAAC,iBAAiB,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;QAClE,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,OAAO;QACd,GAAG,EAAE,SAAS;QACd,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAU;QACjC,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3B,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,IAAU;QAC3B,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,aAAa,CAAC,IAAU;Q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,EAAE,GAAG,MAAM,CAAC,CAAC;QAC9C,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAU,EAAE,KAAa;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;IACvC,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAU,EAAE,KAAa;QACvC,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,cAAc,CAAC,IAAU;QAC9B,OAAO,CACL,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YAClD,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,CAAC,CACrD,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,KAAW,EAAE,MAAY;QAChD,OAAO,CACL,KAAK,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,WAAW,EAAE;YAC5C,KAAK,CAAC,QAAQ,EAAE,KAAK,MAAM,CAAC,QAAQ,EAAE;YACtC,KAAK,CAAC,OAAO,EAAE,KAAK,MAAM,CAAC,OAAO,EAAE,CACrC,CAAC;IACJ,CAAC"}
|
|
@@ -22,6 +22,9 @@ export default class DateService {
|
|
|
22
22
|
/**
|
|
23
23
|
* Gets the date in date format if it is set to midnight, otherwise gets the
|
|
24
24
|
* date in date time format.
|
|
25
|
+
*
|
|
26
|
+
* @param date - The date to format.
|
|
27
|
+
* @returns The formatted date string.
|
|
25
28
|
*/
|
|
26
29
|
static getAutoDateString(date: Date): string {
|
|
27
30
|
if (this.dateHasTime(date)) {
|
|
@@ -33,21 +36,40 @@ export default class DateService {
|
|
|
33
36
|
/**
|
|
34
37
|
* Determines if a date has a user-specified time component to it, meaning
|
|
35
38
|
* that it isn't midnight.
|
|
39
|
+
*
|
|
40
|
+
* @param date - The date to check.
|
|
41
|
+
* @returns True if the date has a time component, false if it is midnight.
|
|
36
42
|
*/
|
|
37
43
|
static dateHasTime(date: Date): boolean {
|
|
38
44
|
return !this.dateIsMidnight(date);
|
|
39
45
|
}
|
|
40
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Formats the date as a string.
|
|
49
|
+
*
|
|
50
|
+
* @param date - The date to format.
|
|
51
|
+
* @returns The formatted date string.
|
|
52
|
+
*/
|
|
41
53
|
static getDateString(date: Date): string {
|
|
42
54
|
return this.dateFormatter.format(date);
|
|
43
55
|
}
|
|
44
56
|
|
|
57
|
+
/**
|
|
58
|
+
* Formats the date and time as a string.
|
|
59
|
+
*
|
|
60
|
+
* @param date - The date to format.
|
|
61
|
+
* @returns The formatted date and time string.
|
|
62
|
+
*/
|
|
45
63
|
static getDateTimeString(date: Date): string {
|
|
46
64
|
return this.dateTimeFormatter.format(date);
|
|
47
65
|
}
|
|
48
66
|
|
|
49
67
|
/**
|
|
50
68
|
* Determines if two dates are equal. This is strict, down to the ms.
|
|
69
|
+
*
|
|
70
|
+
* @param date1 - The first date to compare.
|
|
71
|
+
* @param date2 - The second date to compare.
|
|
72
|
+
* @returns True if the dates are equal, false otherwise.
|
|
51
73
|
*/
|
|
52
74
|
static datesAreEqual(
|
|
53
75
|
date1: Date | undefined | null,
|
|
@@ -65,6 +87,9 @@ export default class DateService {
|
|
|
65
87
|
/**
|
|
66
88
|
* Gets the last day of the month for the provided date. This will retain the
|
|
67
89
|
* time that was provided in the date.
|
|
90
|
+
*
|
|
91
|
+
* @param date - The date to get the last day of the month for.
|
|
92
|
+
* @returns The last day of the month.
|
|
68
93
|
*/
|
|
69
94
|
static getLastDayOfGivenMonth(date: Date): Date {
|
|
70
95
|
// Setting the day to 0, makes the date move to the last day of the
|
|
@@ -77,6 +102,9 @@ export default class DateService {
|
|
|
77
102
|
|
|
78
103
|
/**
|
|
79
104
|
* Gets the week of the month for the provided date. This starts at 1.
|
|
105
|
+
*
|
|
106
|
+
* @param date - The date to get the week of the month for.
|
|
107
|
+
* @returns The week of the month.
|
|
80
108
|
*/
|
|
81
109
|
static getWeekOfMonth(date: Date): number {
|
|
82
110
|
const firstDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1);
|
|
@@ -97,11 +125,24 @@ export default class DateService {
|
|
|
97
125
|
return weeksSinceFirstDayOfSecondWeek + 2;
|
|
98
126
|
}
|
|
99
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Gets the last week of the month for the provided date.
|
|
130
|
+
*
|
|
131
|
+
* @param date - The date to get the last week of the month for.
|
|
132
|
+
* @returns The last week of the month.
|
|
133
|
+
*/
|
|
100
134
|
static getLastWeekOfMonth(date: Date): number {
|
|
101
135
|
const lastDayOfMonth = this.getLastDayOfGivenMonth(date);
|
|
102
136
|
return this.getWeekOfMonth(lastDayOfMonth);
|
|
103
137
|
}
|
|
104
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Gets the number of days until the specified weekday.
|
|
141
|
+
*
|
|
142
|
+
* @param date - The date to start from.
|
|
143
|
+
* @param day - The weekday to get the number of days until.
|
|
144
|
+
* @returns The number of days until the specified weekday.
|
|
145
|
+
*/
|
|
105
146
|
static getDaysUntilWeekDay(date: Date, day: number): number {
|
|
106
147
|
const daysUntilWeekDay = day - date.getDay();
|
|
107
148
|
if (daysUntilWeekDay < 0) {
|
|
@@ -116,6 +157,11 @@ export default class DateService {
|
|
|
116
157
|
*
|
|
117
158
|
* For example, the 2nd Monday of the month, or the last Saturday of the
|
|
118
159
|
* month.
|
|
160
|
+
*
|
|
161
|
+
* @param date - The date to start from.
|
|
162
|
+
* @param day - The weekday to get the date for.
|
|
163
|
+
* @param week - The week of the month to get the date for.
|
|
164
|
+
* @returns The date of the specified weekday in the specified week of the month.
|
|
119
165
|
*/
|
|
120
166
|
static getWeekDayOfXWeekOfMonth(
|
|
121
167
|
date: Date,
|
|
@@ -158,6 +204,10 @@ export default class DateService {
|
|
|
158
204
|
* Adds the provided number of days to the provided date. If the days are
|
|
159
205
|
* over or under the number of days in the month, then the month will be
|
|
160
206
|
* adjusted accordingly.
|
|
207
|
+
*
|
|
208
|
+
* @param date - The date to add days to.
|
|
209
|
+
* @param days - The number of days to add.
|
|
210
|
+
* @returns The new date with the added days.
|
|
161
211
|
*/
|
|
162
212
|
static addDays(date: Date, days: number): Date {
|
|
163
213
|
const newDate = new Date(date);
|
|
@@ -165,16 +215,37 @@ export default class DateService {
|
|
|
165
215
|
return newDate;
|
|
166
216
|
}
|
|
167
217
|
|
|
218
|
+
/**
|
|
219
|
+
* Adds the provided number of months to the provided date.
|
|
220
|
+
*
|
|
221
|
+
* @param date - The date to add months to.
|
|
222
|
+
* @param months - The number of months to add.
|
|
223
|
+
* @returns The new date with the added months.
|
|
224
|
+
*/
|
|
168
225
|
static addMonths(date: Date, months: number): Date {
|
|
169
226
|
const newDate = new Date(date);
|
|
170
227
|
newDate.setMonth(newDate.getMonth() + months);
|
|
171
228
|
return newDate;
|
|
172
229
|
}
|
|
173
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Adds the provided number of weeks to the provided date.
|
|
233
|
+
*
|
|
234
|
+
* @param date - The date to add weeks to.
|
|
235
|
+
* @param weeks - The number of weeks to add.
|
|
236
|
+
* @returns The new date with the added weeks.
|
|
237
|
+
*/
|
|
174
238
|
static addWeeks(date: Date, weeks: number): Date {
|
|
175
239
|
return this.addDays(date, weeks * 7);
|
|
176
240
|
}
|
|
177
241
|
|
|
242
|
+
/**
|
|
243
|
+
* Adds the provided number of years to the provided date.
|
|
244
|
+
*
|
|
245
|
+
* @param date - The date to add years to.
|
|
246
|
+
* @param years - The number of years to add.
|
|
247
|
+
* @returns The new date with the added years.
|
|
248
|
+
*/
|
|
178
249
|
static addYears(date: Date, years: number): Date {
|
|
179
250
|
const newDate = new Date(date);
|
|
180
251
|
newDate.setFullYear(newDate.getFullYear() + years);
|
|
@@ -184,6 +255,9 @@ export default class DateService {
|
|
|
184
255
|
/**
|
|
185
256
|
* For personal projects, midnight can mean exactly midnight, or 11:59pm.
|
|
186
257
|
* It acts as a border between two dates.
|
|
258
|
+
*
|
|
259
|
+
* @param date - The date to check.
|
|
260
|
+
* @returns True if the date is midnight, false otherwise.
|
|
187
261
|
*/
|
|
188
262
|
static dateIsMidnight(date: Date): boolean {
|
|
189
263
|
return (
|
|
@@ -195,9 +269,9 @@ export default class DateService {
|
|
|
195
269
|
/**
|
|
196
270
|
* Determines if the dates are on the same day.
|
|
197
271
|
*
|
|
198
|
-
* @param first
|
|
199
|
-
* @param second
|
|
200
|
-
* @returns
|
|
272
|
+
* @param first - The first date.
|
|
273
|
+
* @param second - The second date.
|
|
274
|
+
* @returns True if they are on the same day, false otherwise.
|
|
201
275
|
*/
|
|
202
276
|
static datesAreOnSameDay(first: Date, second: Date): boolean {
|
|
203
277
|
return (
|
|
@@ -30,6 +30,7 @@ export default class DependencyService {
|
|
|
30
30
|
/**
|
|
31
31
|
* Bumps the version of the package.json and jsr.json files in the current
|
|
32
32
|
* working directory.
|
|
33
|
+
*
|
|
33
34
|
* @param versionType The type of version bump (patch, minor, major).
|
|
34
35
|
*/
|
|
35
36
|
static bumpVersion(versionType?: VersionType): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyService.d.ts","sourceRoot":"./src/","sources":["services/DependencyService.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAY,SAAQ,uBAAuB;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;OAIG;WACU,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgErD
|
|
1
|
+
{"version":3,"file":"DependencyService.d.ts","sourceRoot":"./src/","sources":["services/DependencyService.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAY,SAAQ,uBAAuB;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,oBAAY,WAAW;IACrB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;OAIG;WACU,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC;IAgErD;;;;;OAKG;WACU,WAAW,CACtB,WAAW,GAAE,WAA+B,GAC3C,OAAO,CAAC,IAAI,CAAC;CA+CjB"}
|
|
@@ -70,6 +70,7 @@ export default class DependencyService {
|
|
|
70
70
|
/**
|
|
71
71
|
* Bumps the version of the package.json and jsr.json files in the current
|
|
72
72
|
* working directory.
|
|
73
|
+
*
|
|
73
74
|
* @param versionType The type of version bump (patch, minor, major).
|
|
74
75
|
*/
|
|
75
76
|
static async bumpVersion(versionType = VersionType.Patch) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyService.js","sourceRoot":"./src/","sources":["services/DependencyService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,iBAAiB,MAAM,0CAA0C,CAAC;AAczE;;GAEG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,8BAAe,CAAA;AACjB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,uBAAuB;QAClC,kCAAkC;QAClC,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;QACrE,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CACpC,MAAM,QAAQ,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAC9B,CAAC;QAEjB,6CAA6C;QAC7C,MAAM,SAAS,GAAG,MAAM,iBAAiB,CAAC,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C,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;oBAClD,IAAI,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;wBACjC,eAAe,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;oBAC7D,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;YAED,sCAAsC;YACtC,MAAM,SAAS,CACb,mBAAmB,EACnB,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,CACzC,CAAC;QACJ,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"DependencyService.js","sourceRoot":"./src/","sources":["services/DependencyService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,iBAAiB,MAAM,0CAA0C,CAAC;AAczE;;GAEG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,8BAAe,CAAA;AACjB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAiB;IACpC;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,uBAAuB;QAClC,kCAAkC;QAClC,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;QACrE,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QACpC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC1E,CAAC;QACD,MAAM,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/**
|
|
103
103
|
* Bumps the version of the package.json and jsr.json files in the current
|
|
104
104
|
* working directory.
|
|
105
|
+
*
|
|
105
106
|
* @param versionType The type of version bump (patch, minor, major).
|
|
106
107
|
*/
|
|
107
108
|
static async bumpVersion(
|
|
@@ -4,14 +4,23 @@
|
|
|
4
4
|
export default class ErrorUtils {
|
|
5
5
|
/**
|
|
6
6
|
* Throws an array of errors in a formatted list.
|
|
7
|
+
*
|
|
8
|
+
* @param errorList - The list of error messages.
|
|
9
|
+
* @param erroneousObject - The object related to the errors.
|
|
7
10
|
*/
|
|
8
11
|
static throwErrorList(errorList: string[], erroneousObject: object): void;
|
|
9
12
|
/**
|
|
10
|
-
* Throws an error along with an accompanying
|
|
13
|
+
* Throws an error along with an accompanying erroneous object.
|
|
14
|
+
*
|
|
15
|
+
* @param errorMessage - The error message.
|
|
16
|
+
* @param erroneousObject - The object related to the error.
|
|
11
17
|
*/
|
|
12
18
|
static throwError(errorMessage: string, erroneousObject: object): void;
|
|
13
19
|
/**
|
|
14
20
|
* Gets the error string from an unknown error object.
|
|
21
|
+
*
|
|
22
|
+
* @param error - The unknown error object.
|
|
23
|
+
* @returns The error message as a string.
|
|
15
24
|
*/
|
|
16
25
|
static getErrorString(error: unknown): string;
|
|
17
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorUtils.d.ts","sourceRoot":"./src/","sources":["utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B
|
|
1
|
+
{"version":3,"file":"ErrorUtils.d.ts","sourceRoot":"./src/","sources":["utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM;IAUlE;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAI/D;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAS9C"}
|
package/lib/utils/ErrorUtils.js
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
export default class ErrorUtils {
|
|
5
5
|
/**
|
|
6
6
|
* Throws an array of errors in a formatted list.
|
|
7
|
+
*
|
|
8
|
+
* @param errorList - The list of error messages.
|
|
9
|
+
* @param erroneousObject - The object related to the errors.
|
|
7
10
|
*/
|
|
8
11
|
static throwErrorList(errorList, erroneousObject) {
|
|
9
12
|
let errorString = '';
|
|
@@ -13,13 +16,19 @@ export default class ErrorUtils {
|
|
|
13
16
|
throw new Error(`${errorString}${JSON.stringify(erroneousObject, null, 2)}`);
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
|
-
* Throws an error along with an accompanying
|
|
19
|
+
* Throws an error along with an accompanying erroneous object.
|
|
20
|
+
*
|
|
21
|
+
* @param errorMessage - The error message.
|
|
22
|
+
* @param erroneousObject - The object related to the error.
|
|
17
23
|
*/
|
|
18
24
|
static throwError(errorMessage, erroneousObject) {
|
|
19
25
|
ErrorUtils.throwErrorList([errorMessage], erroneousObject);
|
|
20
26
|
}
|
|
21
27
|
/**
|
|
22
28
|
* Gets the error string from an unknown error object.
|
|
29
|
+
*
|
|
30
|
+
* @param error - The unknown error object.
|
|
31
|
+
* @returns The error message as a string.
|
|
23
32
|
*/
|
|
24
33
|
static getErrorString(error) {
|
|
25
34
|
if (error instanceof Error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorUtils.js","sourceRoot":"./src/","sources":["utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B
|
|
1
|
+
{"version":3,"file":"ErrorUtils.js","sourceRoot":"./src/","sources":["utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,eAAuB;QAChE,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,WAAW,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QACrC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAC5D,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,YAAoB,EAAE,eAAuB;QAC7D,UAAU,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAc;QAClC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
|
package/lib/utils/ErrorUtils.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
export default class ErrorUtils {
|
|
5
5
|
/**
|
|
6
6
|
* Throws an array of errors in a formatted list.
|
|
7
|
+
*
|
|
8
|
+
* @param errorList - The list of error messages.
|
|
9
|
+
* @param erroneousObject - The object related to the errors.
|
|
7
10
|
*/
|
|
8
11
|
static throwErrorList(errorList: string[], erroneousObject: object) {
|
|
9
12
|
let errorString = '';
|
|
@@ -16,7 +19,10 @@ export default class ErrorUtils {
|
|
|
16
19
|
}
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
|
-
* Throws an error along with an accompanying
|
|
22
|
+
* Throws an error along with an accompanying erroneous object.
|
|
23
|
+
*
|
|
24
|
+
* @param errorMessage - The error message.
|
|
25
|
+
* @param erroneousObject - The object related to the error.
|
|
20
26
|
*/
|
|
21
27
|
static throwError(errorMessage: string, erroneousObject: object) {
|
|
22
28
|
ErrorUtils.throwErrorList([errorMessage], erroneousObject);
|
|
@@ -24,6 +30,9 @@ export default class ErrorUtils {
|
|
|
24
30
|
|
|
25
31
|
/**
|
|
26
32
|
* Gets the error string from an unknown error object.
|
|
33
|
+
*
|
|
34
|
+
* @param error - The unknown error object.
|
|
35
|
+
* @returns The error message as a string.
|
|
27
36
|
*/
|
|
28
37
|
static getErrorString(error: unknown): string {
|
|
29
38
|
if (error instanceof Error) {
|
package/lib/utils/Logger.d.ts
CHANGED
|
@@ -2,37 +2,53 @@
|
|
|
2
2
|
* A standard logger that can be used to log messages to the console.
|
|
3
3
|
*/
|
|
4
4
|
export default class Logger {
|
|
5
|
+
/**
|
|
6
|
+
* Indicates if verbose logging is enabled.
|
|
7
|
+
*/
|
|
5
8
|
static verboseLoggingEnabled: boolean;
|
|
6
9
|
/**
|
|
7
10
|
* Private variable that sets if any logging on this instance of the Log
|
|
8
11
|
* should only log if the `verboseLoggingEnabled` is set to true.
|
|
9
12
|
*/
|
|
10
13
|
private logOnlyIfVerbose;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of Logger.
|
|
16
|
+
*
|
|
17
|
+
* @param logOnlyIfVerbose - If true, logging will only occur if verbose logging is enabled.
|
|
18
|
+
*/
|
|
11
19
|
constructor(logOnlyIfVerbose?: boolean);
|
|
12
20
|
/**
|
|
13
21
|
* Sets the logging of the next chained function to only be activated
|
|
14
22
|
* if verbose logging is turned on.
|
|
23
|
+
*
|
|
24
|
+
* @returns A new Logger instance with verbose logging enabled.
|
|
15
25
|
*/
|
|
16
26
|
static get verbose(): Logger;
|
|
17
27
|
/**
|
|
18
28
|
* Logs info to the console. Prepends `ℹ️` to each message.
|
|
29
|
+
*
|
|
30
|
+
* @param msg - The message to log.
|
|
31
|
+
* @param skipNewline - If true, the message will be logged without a newline.
|
|
19
32
|
*/
|
|
20
33
|
info(msg: string, skipNewline?: boolean): void;
|
|
21
34
|
/**
|
|
22
35
|
* Static version of {@link Logger.prototype.info}.
|
|
23
36
|
*
|
|
37
|
+
* @param msg - The message to log.
|
|
38
|
+
* @param skipNewline - If true, the message will be logged without a newline.
|
|
24
39
|
* @see Logger.prototype.info
|
|
25
40
|
*/
|
|
26
41
|
static info(msg: string, skipNewline?: boolean): void;
|
|
27
42
|
/**
|
|
28
43
|
* Logs a success message to the console. Prepends `✅` to each message.
|
|
29
44
|
*
|
|
30
|
-
* @param msg
|
|
45
|
+
* @param msg - The message to log.
|
|
31
46
|
*/
|
|
32
47
|
success(msg: string): void;
|
|
33
48
|
/**
|
|
34
49
|
* Static version of {@link Logger.prototype.success}.
|
|
35
50
|
*
|
|
51
|
+
* @param msg - The message to log.
|
|
36
52
|
* @see Logger.prototype.success
|
|
37
53
|
*/
|
|
38
54
|
static success(msg: string): void;
|
|
@@ -42,12 +58,14 @@ export default class Logger {
|
|
|
42
58
|
* See {@link error} for logging errors.
|
|
43
59
|
*
|
|
44
60
|
* This doesn't use a `console.error` entry. Just a `console.log` entry.
|
|
45
|
-
*
|
|
61
|
+
*
|
|
62
|
+
* @param msg - The message to log.
|
|
46
63
|
*/
|
|
47
64
|
failure(msg: string): void;
|
|
48
65
|
/**
|
|
49
66
|
* Static version of {@link Logger.prototype.failure}.
|
|
50
67
|
*
|
|
68
|
+
* @param msg - The message to log.
|
|
51
69
|
* @see Logger.prototype.failure
|
|
52
70
|
*/
|
|
53
71
|
static failure(msg: string): void;
|
|
@@ -57,15 +75,21 @@ export default class Logger {
|
|
|
57
75
|
*
|
|
58
76
|
* See {@link failure} for logging simple failures.
|
|
59
77
|
*
|
|
60
|
-
* @param msg
|
|
78
|
+
* @param msg - The message to log.
|
|
61
79
|
*/
|
|
62
80
|
error(msg: string): void;
|
|
63
81
|
/**
|
|
64
82
|
* Static version of {@link Logger.prototype.error}.
|
|
65
83
|
*
|
|
84
|
+
* @param msg - The message to log.
|
|
66
85
|
* @see Logger.prototype.error
|
|
67
86
|
*/
|
|
68
87
|
static error(msg: string): void;
|
|
88
|
+
/**
|
|
89
|
+
* Determines if the message should be logged based on the verbose logging settings.
|
|
90
|
+
*
|
|
91
|
+
* @returns True if the message should be logged, false otherwise.
|
|
92
|
+
*/
|
|
69
93
|
private shouldLog;
|
|
70
94
|
}
|
|
71
95
|
//# sourceMappingURL=Logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"./src/","sources":["utils/Logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAc,qBAAqB,UAAS;IAE5C;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAS;
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"./src/","sources":["utils/Logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB;;OAEG;IACH,OAAc,qBAAqB,UAAS;IAE5C;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAS;IAEjC;;;;OAIG;gBACS,gBAAgB,CAAC,EAAE,OAAO;IAMtC;;;;;OAKG;IACH,MAAM,KAAK,OAAO,IAAI,MAAM,CAE3B;IAED;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAW9C;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAIrD;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;;OAQG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMxB;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACH,OAAO,CAAC,SAAS;CAMlB"}
|
package/lib/utils/Logger.js
CHANGED
|
@@ -2,12 +2,20 @@
|
|
|
2
2
|
* A standard logger that can be used to log messages to the console.
|
|
3
3
|
*/
|
|
4
4
|
export default class Logger {
|
|
5
|
+
/**
|
|
6
|
+
* Indicates if verbose logging is enabled.
|
|
7
|
+
*/
|
|
5
8
|
static verboseLoggingEnabled = false;
|
|
6
9
|
/**
|
|
7
10
|
* Private variable that sets if any logging on this instance of the Log
|
|
8
11
|
* should only log if the `verboseLoggingEnabled` is set to true.
|
|
9
12
|
*/
|
|
10
13
|
logOnlyIfVerbose = false;
|
|
14
|
+
/**
|
|
15
|
+
* Creates an instance of Logger.
|
|
16
|
+
*
|
|
17
|
+
* @param logOnlyIfVerbose - If true, logging will only occur if verbose logging is enabled.
|
|
18
|
+
*/
|
|
11
19
|
constructor(logOnlyIfVerbose) {
|
|
12
20
|
if (logOnlyIfVerbose) {
|
|
13
21
|
this.logOnlyIfVerbose = logOnlyIfVerbose;
|
|
@@ -16,12 +24,17 @@ export default class Logger {
|
|
|
16
24
|
/**
|
|
17
25
|
* Sets the logging of the next chained function to only be activated
|
|
18
26
|
* if verbose logging is turned on.
|
|
27
|
+
*
|
|
28
|
+
* @returns A new Logger instance with verbose logging enabled.
|
|
19
29
|
*/
|
|
20
30
|
static get verbose() {
|
|
21
31
|
return new Logger(true);
|
|
22
32
|
}
|
|
23
33
|
/**
|
|
24
34
|
* Logs info to the console. Prepends `ℹ️` to each message.
|
|
35
|
+
*
|
|
36
|
+
* @param msg - The message to log.
|
|
37
|
+
* @param skipNewline - If true, the message will be logged without a newline.
|
|
25
38
|
*/
|
|
26
39
|
info(msg, skipNewline) {
|
|
27
40
|
if (this.shouldLog()) {
|
|
@@ -37,6 +50,8 @@ export default class Logger {
|
|
|
37
50
|
/**
|
|
38
51
|
* Static version of {@link Logger.prototype.info}.
|
|
39
52
|
*
|
|
53
|
+
* @param msg - The message to log.
|
|
54
|
+
* @param skipNewline - If true, the message will be logged without a newline.
|
|
40
55
|
* @see Logger.prototype.info
|
|
41
56
|
*/
|
|
42
57
|
static info(msg, skipNewline) {
|
|
@@ -45,7 +60,7 @@ export default class Logger {
|
|
|
45
60
|
/**
|
|
46
61
|
* Logs a success message to the console. Prepends `✅` to each message.
|
|
47
62
|
*
|
|
48
|
-
* @param msg
|
|
63
|
+
* @param msg - The message to log.
|
|
49
64
|
*/
|
|
50
65
|
success(msg) {
|
|
51
66
|
if (this.shouldLog()) {
|
|
@@ -55,6 +70,7 @@ export default class Logger {
|
|
|
55
70
|
/**
|
|
56
71
|
* Static version of {@link Logger.prototype.success}.
|
|
57
72
|
*
|
|
73
|
+
* @param msg - The message to log.
|
|
58
74
|
* @see Logger.prototype.success
|
|
59
75
|
*/
|
|
60
76
|
static success(msg) {
|
|
@@ -66,7 +82,8 @@ export default class Logger {
|
|
|
66
82
|
* See {@link error} for logging errors.
|
|
67
83
|
*
|
|
68
84
|
* This doesn't use a `console.error` entry. Just a `console.log` entry.
|
|
69
|
-
*
|
|
85
|
+
*
|
|
86
|
+
* @param msg - The message to log.
|
|
70
87
|
*/
|
|
71
88
|
failure(msg) {
|
|
72
89
|
if (this.shouldLog()) {
|
|
@@ -76,6 +93,7 @@ export default class Logger {
|
|
|
76
93
|
/**
|
|
77
94
|
* Static version of {@link Logger.prototype.failure}.
|
|
78
95
|
*
|
|
96
|
+
* @param msg - The message to log.
|
|
79
97
|
* @see Logger.prototype.failure
|
|
80
98
|
*/
|
|
81
99
|
static failure(msg) {
|
|
@@ -87,7 +105,7 @@ export default class Logger {
|
|
|
87
105
|
*
|
|
88
106
|
* See {@link failure} for logging simple failures.
|
|
89
107
|
*
|
|
90
|
-
* @param msg
|
|
108
|
+
* @param msg - The message to log.
|
|
91
109
|
*/
|
|
92
110
|
error(msg) {
|
|
93
111
|
if (this.shouldLog()) {
|
|
@@ -97,11 +115,17 @@ export default class Logger {
|
|
|
97
115
|
/**
|
|
98
116
|
* Static version of {@link Logger.prototype.error}.
|
|
99
117
|
*
|
|
118
|
+
* @param msg - The message to log.
|
|
100
119
|
* @see Logger.prototype.error
|
|
101
120
|
*/
|
|
102
121
|
static error(msg) {
|
|
103
122
|
new Logger().error(msg);
|
|
104
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Determines if the message should be logged based on the verbose logging settings.
|
|
126
|
+
*
|
|
127
|
+
* @returns True if the message should be logged, false otherwise.
|
|
128
|
+
*/
|
|
105
129
|
shouldLog() {
|
|
106
130
|
if (!this.logOnlyIfVerbose || Logger.verboseLoggingEnabled) {
|
|
107
131
|
return true;
|
package/lib/utils/Logger.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","sourceRoot":"./src/","sources":["utils/Logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;
|
|
1
|
+
{"version":3,"file":"Logger.js","sourceRoot":"./src/","sources":["utils/Logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB;;OAEG;IACI,MAAM,CAAC,qBAAqB,GAAG,KAAK,CAAC;IAE5C;;;OAGG;IACK,gBAAgB,GAAG,KAAK,CAAC;IAEjC;;;;OAIG;IACH,YAAY,gBA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AAI,MAAM,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,GAAW;QACf,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,CAAC,GAAW;QACtB,IAAI,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACK,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAAC,qBAAqB,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC"}
|
package/lib/utils/Logger.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* A standard logger that can be used to log messages to the console.
|
|
3
3
|
*/
|
|
4
4
|
export default class Logger {
|
|
5
|
+
/**
|
|
6
|
+
* Indicates if verbose logging is enabled.
|
|
7
|
+
*/
|
|
5
8
|
public static verboseLoggingEnabled = false;
|
|
6
9
|
|
|
7
10
|
/**
|
|
@@ -10,6 +13,11 @@ export default class Logger {
|
|
|
10
13
|
*/
|
|
11
14
|
private logOnlyIfVerbose = false;
|
|
12
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Creates an instance of Logger.
|
|
18
|
+
*
|
|
19
|
+
* @param logOnlyIfVerbose - If true, logging will only occur if verbose logging is enabled.
|
|
20
|
+
*/
|
|
13
21
|
constructor(logOnlyIfVerbose?: boolean) {
|
|
14
22
|
if (logOnlyIfVerbose) {
|
|
15
23
|
this.logOnlyIfVerbose = logOnlyIfVerbose;
|
|
@@ -19,6 +27,8 @@ export default class Logger {
|
|
|
19
27
|
/**
|
|
20
28
|
* Sets the logging of the next chained function to only be activated
|
|
21
29
|
* if verbose logging is turned on.
|
|
30
|
+
*
|
|
31
|
+
* @returns A new Logger instance with verbose logging enabled.
|
|
22
32
|
*/
|
|
23
33
|
static get verbose(): Logger {
|
|
24
34
|
return new Logger(true);
|
|
@@ -26,6 +36,9 @@ export default class Logger {
|
|
|
26
36
|
|
|
27
37
|
/**
|
|
28
38
|
* Logs info to the console. Prepends `ℹ️` to each message.
|
|
39
|
+
*
|
|
40
|
+
* @param msg - The message to log.
|
|
41
|
+
* @param skipNewline - If true, the message will be logged without a newline.
|
|
29
42
|
*/
|
|
30
43
|
info(msg: string, skipNewline?: boolean): void {
|
|
31
44
|
if (this.shouldLog()) {
|
|
@@ -41,6 +54,8 @@ export default class Logger {
|
|
|
41
54
|
/**
|
|
42
55
|
* Static version of {@link Logger.prototype.info}.
|
|
43
56
|
*
|
|
57
|
+
* @param msg - The message to log.
|
|
58
|
+
* @param skipNewline - If true, the message will be logged without a newline.
|
|
44
59
|
* @see Logger.prototype.info
|
|
45
60
|
*/
|
|
46
61
|
static info(msg: string, skipNewline?: boolean): void {
|
|
@@ -50,7 +65,7 @@ export default class Logger {
|
|
|
50
65
|
/**
|
|
51
66
|
* Logs a success message to the console. Prepends `✅` to each message.
|
|
52
67
|
*
|
|
53
|
-
* @param msg
|
|
68
|
+
* @param msg - The message to log.
|
|
54
69
|
*/
|
|
55
70
|
success(msg: string): void {
|
|
56
71
|
if (this.shouldLog()) {
|
|
@@ -61,6 +76,7 @@ export default class Logger {
|
|
|
61
76
|
/**
|
|
62
77
|
* Static version of {@link Logger.prototype.success}.
|
|
63
78
|
*
|
|
79
|
+
* @param msg - The message to log.
|
|
64
80
|
* @see Logger.prototype.success
|
|
65
81
|
*/
|
|
66
82
|
static success(msg: string): void {
|
|
@@ -73,7 +89,8 @@ export default class Logger {
|
|
|
73
89
|
* See {@link error} for logging errors.
|
|
74
90
|
*
|
|
75
91
|
* This doesn't use a `console.error` entry. Just a `console.log` entry.
|
|
76
|
-
*
|
|
92
|
+
*
|
|
93
|
+
* @param msg - The message to log.
|
|
77
94
|
*/
|
|
78
95
|
failure(msg: string): void {
|
|
79
96
|
if (this.shouldLog()) {
|
|
@@ -84,6 +101,7 @@ export default class Logger {
|
|
|
84
101
|
/**
|
|
85
102
|
* Static version of {@link Logger.prototype.failure}.
|
|
86
103
|
*
|
|
104
|
+
* @param msg - The message to log.
|
|
87
105
|
* @see Logger.prototype.failure
|
|
88
106
|
*/
|
|
89
107
|
static failure(msg: string): void {
|
|
@@ -96,7 +114,7 @@ export default class Logger {
|
|
|
96
114
|
*
|
|
97
115
|
* See {@link failure} for logging simple failures.
|
|
98
116
|
*
|
|
99
|
-
* @param msg
|
|
117
|
+
* @param msg - The message to log.
|
|
100
118
|
*/
|
|
101
119
|
error(msg: string): void {
|
|
102
120
|
if (this.shouldLog()) {
|
|
@@ -107,12 +125,18 @@ export default class Logger {
|
|
|
107
125
|
/**
|
|
108
126
|
* Static version of {@link Logger.prototype.error}.
|
|
109
127
|
*
|
|
128
|
+
* @param msg - The message to log.
|
|
110
129
|
* @see Logger.prototype.error
|
|
111
130
|
*/
|
|
112
131
|
static error(msg: string): void {
|
|
113
132
|
new Logger().error(msg);
|
|
114
133
|
}
|
|
115
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Determines if the message should be logged based on the verbose logging settings.
|
|
137
|
+
*
|
|
138
|
+
* @returns True if the message should be logged, false otherwise.
|
|
139
|
+
*/
|
|
116
140
|
private shouldLog(): boolean {
|
|
117
141
|
if (!this.logOnlyIfVerbose || Logger.verboseLoggingEnabled) {
|
|
118
142
|
return true;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@aneuhold/core-ts-lib",
|
|
3
3
|
"author": "Anton G. Neuhold Jr.",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "2.0.
|
|
5
|
+
"version": "2.0.8",
|
|
6
6
|
"description": "A core library for all of my TypeScript projects",
|
|
7
7
|
"packageManager": "yarn@4.5.1",
|
|
8
8
|
"type": "module",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"Node.js"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@aneuhold/eslint-config": "^1.0.
|
|
44
|
-
"@types/jest": "^29
|
|
45
|
-
"@types/node": "^
|
|
46
|
-
"eslint": "^9
|
|
47
|
-
"jest": "^29.7
|
|
43
|
+
"@aneuhold/eslint-config": "^1.0.54",
|
|
44
|
+
"@types/jest": "^29.*",
|
|
45
|
+
"@types/node": "^22.*",
|
|
46
|
+
"eslint": "^9.*",
|
|
47
|
+
"jest": "^29.7.*",
|
|
48
48
|
"jsr": "*",
|
|
49
|
-
"prettier": "^3
|
|
49
|
+
"prettier": "^3.*",
|
|
50
50
|
"rimraf": "^6.0.1",
|
|
51
51
|
"ts-jest": "^29.2.5",
|
|
52
52
|
"tsx": "^4.19.1",
|
|
53
|
-
"typescript": "
|
|
53
|
+
"typescript": "~5.7.3"
|
|
54
54
|
}
|
|
55
55
|
}
|