topkat-utils 1.3.24 → 1.3.25
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/README.md +1 -1
- package/backend.ts +3 -4
- package/dist/backend.js +3 -4
- package/dist/backend.js.map +1 -1
- package/dist/src/array-utils.d.ts +1 -1
- package/dist/src/array-utils.js +2 -2
- package/dist/src/array-utils.js.map +1 -1
- package/dist/src/clean-stack-trace.js.map +1 -1
- package/dist/src/date-utils.d.ts +25 -20
- package/dist/src/date-utils.js +1 -0
- package/dist/src/date-utils.js.map +1 -1
- package/dist/src/env-utils.d.ts +1 -1
- package/dist/src/env-utils.js.map +1 -1
- package/dist/src/error-utils.d.ts +6 -6
- package/dist/src/error-utils.js.map +1 -1
- package/dist/src/isset.js.map +1 -1
- package/dist/src/logger-utils.d.ts +33 -30
- package/dist/src/logger-utils.js +10 -29
- package/dist/src/logger-utils.js.map +1 -1
- package/dist/src/loop-utils.d.ts +4 -4
- package/dist/src/loop-utils.js.map +1 -1
- package/dist/src/mongo-utils.js.map +1 -1
- package/dist/src/object-utils.d.ts +4 -4
- package/dist/src/object-utils.js +1 -1
- package/dist/src/object-utils.js.map +1 -1
- package/dist/src/regexp-utils.d.ts +1 -1
- package/dist/src/regexp-utils.js.map +1 -1
- package/dist/src/remove-circular-json-stringify.d.ts +1 -1
- package/dist/src/remove-circular-json-stringify.js.map +1 -1
- package/dist/src/string-utils.d.ts +4 -4
- package/dist/src/string-utils.js +1 -1
- package/dist/src/string-utils.js.map +1 -1
- package/dist/src/tests-utils.js.map +1 -1
- package/dist/src/timer-utils.d.ts +4 -4
- package/dist/src/timer-utils.js +1 -1
- package/dist/src/timer-utils.js.map +1 -1
- package/dist/src/transaction-utils.d.ts +3 -3
- package/dist/src/transaction-utils.js.map +1 -1
- package/dist/src/transaction-utils.spec.js +1 -1
- package/dist/src/transaction-utils.spec.js.map +1 -1
- package/dist/src/validation-utils.d.ts +3 -3
- package/dist/src/validation-utils.js +17 -16
- package/dist/src/validation-utils.js.map +1 -1
- package/dist/src/wtf-utils.d.ts +3 -3
- package/dist/src/wtf-utils.js +1 -1
- package/dist/src/wtf-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/array-utils.ts +3 -3
- package/src/clean-stack-trace.ts +1 -1
- package/src/date-utils.ts +45 -41
- package/src/env-utils.ts +1 -1
- package/src/error-utils.ts +8 -8
- package/src/isset.ts +1 -1
- package/src/logger-utils.ts +40 -52
- package/src/loop-utils.ts +5 -5
- package/src/mongo-utils.ts +1 -1
- package/src/object-utils.ts +22 -22
- package/src/regexp-utils.ts +3 -3
- package/src/remove-circular-json-stringify.ts +2 -2
- package/src/string-utils.ts +3 -3
- package/src/tests-utils.ts +1 -1
- package/src/timer-utils.ts +4 -4
- package/src/transaction-utils.spec.ts +1 -1
- package/src/transaction-utils.ts +5 -5
- package/src/validation-utils.ts +28 -26
- package/src/wtf-utils.ts +6 -6
- package/tsconfig.json +1 -1
package/dist/src/wtf-utils.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function chineseProverb(): string;
|
|
2
|
-
export declare function randomEmoji(msg:
|
|
2
|
+
export declare function randomEmoji(msg: string, length?: number): string;
|
|
3
3
|
/** STRING COMPRESSOR
|
|
4
4
|
* peut facilement être utilisé par uncomp directement (stock les metadonnées sur la comp)
|
|
5
5
|
*/
|
|
6
|
-
export declare function compAuto(str:
|
|
7
|
-
export declare function unComp(str:
|
|
6
|
+
export declare function compAuto(str: string): string;
|
|
7
|
+
export declare function unComp(str: string): string;
|
package/dist/src/wtf-utils.js
CHANGED
|
@@ -26,7 +26,7 @@ function compAuto(str) {
|
|
|
26
26
|
const utf8Chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ:;<=>%?@"#$&\'()*+,-./[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u007f€\u0081‚ƒ„…†‡ˆ‰Š‹ŒŽ\u008f‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĮįİıIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňʼnŊŋŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŹźŻżſƀƁƂƃƄƅƆƇƈƉƊƋƌƍƎƏƐƑƓƔƕƖƗƘƙƚƛƜƝƞƟ'.split('');
|
|
27
27
|
const unusedChars = utf8Chars.filter(c => !str.includes(c));
|
|
28
28
|
const charMap = [];
|
|
29
|
-
const mostFreqStr = str2 => {
|
|
29
|
+
const mostFreqStr = (str2) => {
|
|
30
30
|
const o = {};
|
|
31
31
|
// recherche la meilleure optim selon le nb de char
|
|
32
32
|
for (let strLength = 2; strLength < 16; strLength++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wtf-utils.js","sourceRoot":"","sources":["../../src/wtf-utils.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,YAAY;AACZ,0CAA0C;;;AAE1C,iDAA6C;AAC7C,iDAAkC;AAClC,mCAA+B;AAE/B,SAAgB,cAAc;IAC1B,eAAe;IACf,MAAM,GAAG,GAAG,0kBAA0kB,CAAA;IACtlB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,G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
23
23
|
* @return obj[addr] eventually processed by the callback
|
|
24
24
|
*/
|
|
25
25
|
export function ensureIsArrayAndPush(obj: object, addr: string, valToPush: any, onlyUniqueValues?: Function) {
|
|
26
|
-
return ensureObjectProp(obj, addr, [], objValue => {
|
|
26
|
+
return ensureObjectProp(obj, addr, [], (objValue: any) => {
|
|
27
27
|
if (isset(onlyUniqueValues)) {
|
|
28
28
|
let duplicateFound = false
|
|
29
|
-
if (typeof onlyUniqueValues === 'function') duplicateFound = objValue.some(a => onlyUniqueValues(a, valToPush))
|
|
29
|
+
if (typeof onlyUniqueValues === 'function') duplicateFound = objValue.some((a: any) => onlyUniqueValues(a, valToPush))
|
|
30
30
|
else duplicateFound = objValue.includes(valToPush)
|
|
31
31
|
if (!duplicateFound) objValue.push(valToPush)
|
|
32
32
|
} else objValue.push(valToPush)
|
|
@@ -102,7 +102,7 @@ export function pushIfNotExist<T>(arrayToPushInto: T[], valueOrArrayOfValuesToBe
|
|
|
102
102
|
return arrayToPushInto
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
export function isNotEmptyArray(arr): boolean {
|
|
105
|
+
export function isNotEmptyArray(arr: any[]): boolean {
|
|
106
106
|
return Array.isArray(arr) && !!arr.length
|
|
107
107
|
}
|
|
108
108
|
|
package/src/clean-stack-trace.ts
CHANGED
package/src/date-utils.ts
CHANGED
|
@@ -8,17 +8,19 @@ import { err422IfNotSet } from './error-utils'
|
|
|
8
8
|
|
|
9
9
|
const int = parseInt
|
|
10
10
|
|
|
11
|
-
export function getDateAsInt12(dateAllFormat?: Date | string | number, errIfNotValid
|
|
11
|
+
export function getDateAsInt12(dateAllFormat?: Date | string | number, errIfNotValid?: any): string { return getDateAsInt(dateAllFormat, errIfNotValid, true) } // alias
|
|
12
12
|
|
|
13
|
-
export function humanReadableTimestamp(dateAllFormat:
|
|
13
|
+
export function humanReadableTimestamp(dateAllFormat: DateAllFormat): number {
|
|
14
14
|
if (isset(dateAllFormat)) dateAllFormat = getDateAsObject(dateAllFormat)
|
|
15
|
-
return parseInt(getDateAsInt12(dateAllFormat) + pad((dateAllFormat || new Date()).getUTCSeconds()) + pad((dateAllFormat || new Date()).getUTCMilliseconds(), 3))
|
|
15
|
+
return parseInt(getDateAsInt12(dateAllFormat) + pad(((dateAllFormat as Date) || new Date()).getUTCSeconds()) + pad(((dateAllFormat as Date) || new Date()).getUTCMilliseconds(), 3))
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// type DateAllFormat = Date | string | number
|
|
19
|
+
|
|
18
20
|
/** format for 6/8/2018 => 20180806
|
|
19
21
|
* @param dateAllFormat multiple format allowed 2012, 20120101, 201201011200, new Date(), "2019-12-08T16:19:10.341Z" and all string that new Date() can parse
|
|
20
22
|
*/
|
|
21
|
-
export function getDateAsInt(dateAllFormat:
|
|
23
|
+
export function getDateAsInt(dateAllFormat: DateAllFormat = new Date(), errIfNotValid$ = false, withHoursAndMinutes$ = false): string { // optional
|
|
22
24
|
let dateInt
|
|
23
25
|
if (typeof dateAllFormat === 'string' && dateAllFormat.includes('/')) {
|
|
24
26
|
// 01/01/2020 format
|
|
@@ -39,7 +41,7 @@ export function getDateAsInt(dateAllFormat: Date | string | number = new Date(),
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
|
|
42
|
-
export function getMonthAsInt(dateAllFormat:
|
|
44
|
+
export function getMonthAsInt(dateAllFormat: DateAllFormat = new Date()): number {
|
|
43
45
|
let dateInt
|
|
44
46
|
if (isDateIntOrStringValid(dateAllFormat)) {
|
|
45
47
|
// we can pass an int or string format (20180106)
|
|
@@ -55,22 +57,22 @@ export function getMonthAsInt(dateAllFormat: Date | string | number = new Date()
|
|
|
55
57
|
/**
|
|
56
58
|
* @param dateAllFormat multiple format allowed 2012, 20120101, 201201011200, new Date(), "2019-12-08T16:19:10.341Z" and all string that new Date() can parse
|
|
57
59
|
*/
|
|
58
|
-
export function getDateAsObject(dateAllFormat:
|
|
60
|
+
export function getDateAsObject(dateAllFormat: DateAllFormat = new Date(), errIfNotValid$ = true): Date {
|
|
59
61
|
let dateObj = dateAllFormat
|
|
60
62
|
if (isDateIntOrStringValid(dateAllFormat)) {
|
|
61
|
-
const [y, M, d, h, m] = dateStringToArray(dateAllFormat)
|
|
63
|
+
const [y, M, d, h, m] = dateStringToArray(dateAllFormat as string)
|
|
62
64
|
dateObj = new Date(`${y}-${M}-${d}T${h}:${m}`)
|
|
63
65
|
} else if (typeof dateAllFormat === 'string') {
|
|
64
66
|
dateObj = new Date(dateAllFormat)
|
|
65
67
|
} else {
|
|
66
|
-
dateObj = new Date(dateAllFormat.getTime()) // clone
|
|
68
|
+
dateObj = new Date((dateAllFormat as Date).getTime()) // clone
|
|
67
69
|
}
|
|
68
70
|
isDateIsoOrObjectValid(dateObj, errIfNotValid$)
|
|
69
71
|
return dateObj
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
/** [2018,01,06] */
|
|
73
|
-
export function dateStringToArray(strOrInt) {
|
|
75
|
+
export function dateStringToArray(strOrInt: string | number) {
|
|
74
76
|
err422IfNotSet({ strOrInt })
|
|
75
77
|
|
|
76
78
|
const dateStr = strOrInt.toString()
|
|
@@ -88,7 +90,7 @@ export function dateStringToArray(strOrInt) {
|
|
|
88
90
|
/**
|
|
89
91
|
* @param dateAllFormat default: actualDate
|
|
90
92
|
* @returns ['01', '01', '2019'] OR **string** if separator is provided */
|
|
91
|
-
export function dateArray(dateAllFormat:
|
|
93
|
+
export function dateArray(dateAllFormat: DateAllFormat = getDateAsInt()): [string, string, string] {
|
|
92
94
|
const dateStr = getDateAsInt(dateAllFormat).toString()
|
|
93
95
|
return [
|
|
94
96
|
dateStr.substr(6, 2), // D
|
|
@@ -100,7 +102,7 @@ export function dateArray(dateAllFormat: Date | string | number = getDateAsInt()
|
|
|
100
102
|
/**
|
|
101
103
|
* @param dateAllFormat default: actualDate
|
|
102
104
|
* @returns ['01', '01', '2019'] OR **string** if separator is provided */
|
|
103
|
-
export function dateArrayInt(dateAllFormat:
|
|
105
|
+
export function dateArrayInt(dateAllFormat: DateAllFormat = getDateAsInt()): [number, number, number] {
|
|
104
106
|
const dateStr = getDateAsInt(dateAllFormat).toString()
|
|
105
107
|
return [
|
|
106
108
|
int(dateStr.substr(6, 2)), // D
|
|
@@ -113,10 +115,10 @@ export function dateArrayInt(dateAllFormat: Date | string | number = getDateAsIn
|
|
|
113
115
|
/**
|
|
114
116
|
* @return 01/01/2012 (alias of dateArrayFormatted(date, '/'))
|
|
115
117
|
*/
|
|
116
|
-
export function dateFormatted(dateAllFormat:
|
|
118
|
+
export function dateFormatted(dateAllFormat: DateAllFormat, separator = '/') { return dateArray(dateAllFormat).join(separator) }
|
|
117
119
|
|
|
118
120
|
/** Date with custom offset (Ex: +2 for France) */
|
|
119
|
-
export function dateOffset(offsetHours, dateObj = new Date()) {
|
|
121
|
+
export function dateOffset(offsetHours: number, dateObj = new Date()) {
|
|
120
122
|
|
|
121
123
|
const utc = Date.UTC(dateObj.getUTCFullYear(), dateObj.getUTCMonth(), dateObj.getUTCDate(),
|
|
122
124
|
dateObj.getUTCHours(), dateObj.getUTCMinutes(), dateObj.getUTCSeconds())
|
|
@@ -148,7 +150,7 @@ export function getIntAsTime(intOrDateTimeInt = getDateAsInt12(), separator = ':
|
|
|
148
150
|
return time.substring(tl - 4, tl - 2) + separator + time.substring(tl - 2, tl)
|
|
149
151
|
}
|
|
150
152
|
|
|
151
|
-
export function isTimeStringValid(timeStr, outputAnError$ = false) {
|
|
153
|
+
export function isTimeStringValid(timeStr: string, outputAnError$ = false) {
|
|
152
154
|
const timeArr = timeStr.split(':')
|
|
153
155
|
const h = int(timeArr[0])
|
|
154
156
|
const m = int(timeArr[1])
|
|
@@ -162,7 +164,7 @@ export function isTimeStringValid(timeStr, outputAnError$ = false) {
|
|
|
162
164
|
// DURATIONS
|
|
163
165
|
//----------------------------------------
|
|
164
166
|
|
|
165
|
-
export function getDuration(startDate, endDate, inMinutes = false) {
|
|
167
|
+
export function getDuration(startDate: any, endDate: any, inMinutes = false) {
|
|
166
168
|
const startDateO = getDateAsObject(startDate)
|
|
167
169
|
const endDateO = getDateAsObject(endDate)
|
|
168
170
|
const diffInSec = Math.floor(endDateO.getTime() / 1000) - Math.floor(startDateO.getTime() / 1000)
|
|
@@ -175,6 +177,7 @@ export function getDuration(startDate, endDate, inMinutes = false) {
|
|
|
175
177
|
]
|
|
176
178
|
}
|
|
177
179
|
|
|
180
|
+
type DateEvent = { startDate: any, endDate: any }
|
|
178
181
|
/** compare two object with DATE INT, if they overlap return true
|
|
179
182
|
* @param {Object} event1 {startDate, endDate}
|
|
180
183
|
* @param {Object} event2 {startDate, endDate}
|
|
@@ -183,7 +186,7 @@ export function getDuration(startDate, endDate, inMinutes = false) {
|
|
|
183
186
|
* @param {Boolean} allowNull$ if false, retrun false if any of the startdates or enddates are not set
|
|
184
187
|
* @param {Boolean} strict$ if true,
|
|
185
188
|
*/
|
|
186
|
-
export function doDateOverlap(event1, event2, fieldNameForStartDate$ = 'startDate', fieldNameForEndDate$ = 'endDate', allowNull$ = true, strict$ = false) {
|
|
189
|
+
export function doDateOverlap(event1: DateEvent, event2: DateEvent, fieldNameForStartDate$ = 'startDate' as const, fieldNameForEndDate$ = 'endDate' as const, allowNull$ = true, strict$ = false) {
|
|
187
190
|
if (!allowNull$ && !isset(event1[fieldNameForStartDate$], event1[fieldNameForEndDate$], event2[fieldNameForStartDate$], event2[fieldNameForEndDate$])) return false
|
|
188
191
|
|
|
189
192
|
if (strict$)
|
|
@@ -192,13 +195,14 @@ export function doDateOverlap(event1, event2, fieldNameForStartDate$ = 'startDat
|
|
|
192
195
|
return (!event2[fieldNameForEndDate$] || event1[fieldNameForStartDate$] <= event2[fieldNameForEndDate$]) && (!event1[fieldNameForEndDate$] || event1[fieldNameForEndDate$] >= event2[fieldNameForStartDate$])
|
|
193
196
|
}
|
|
194
197
|
|
|
195
|
-
type DateAllFormat =
|
|
198
|
+
type DateAllFormat = Date | string | number
|
|
199
|
+
type DateAllFormatString = DateObjectFormat | DateStringFormats
|
|
196
200
|
type DateStringFormats = 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'
|
|
197
201
|
type DateObjectFormat = 'date'
|
|
198
202
|
|
|
199
|
-
export function nextWeekDay(fromDate, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: DateStringFormats, sameDayAllowed?: boolean): number
|
|
200
|
-
export function nextWeekDay(fromDate, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: DateObjectFormat, sameDayAllowed?: boolean): Date
|
|
201
|
-
export function nextWeekDay(fromDate, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat = 'date', sameDayAllowed = false): any {
|
|
203
|
+
export function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: DateStringFormats, sameDayAllowed?: boolean): number
|
|
204
|
+
export function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: DateObjectFormat, sameDayAllowed?: boolean): Date
|
|
205
|
+
export function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat = 'date', sameDayAllowed = false): any {
|
|
202
206
|
const date = getDateAsObject(fromDate)
|
|
203
207
|
if (typeof weekDayInt === 'undefined') weekDayInt = (date.getDay() as 0 | 1 | 2 | 3 | 4 | 5 | 6)
|
|
204
208
|
const toAdd = !sameDayAllowed && date.getDay() === weekDayInt ? 7 : 0
|
|
@@ -211,7 +215,7 @@ export function nextWeekDay(fromDate, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, ou
|
|
|
211
215
|
*/
|
|
212
216
|
export function addDays(dateAllFormat?: Date | string | number, numberOfDays?: number, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string
|
|
213
217
|
export function addDays(dateAllFormat?: Date | string | number, numberOfDays?: number, outputFormat?: 'date'): Date
|
|
214
|
-
export function addDays(dateAllFormat:
|
|
218
|
+
export function addDays(dateAllFormat: DateAllFormat = getDateAsInt(), numberOfDays = 1, outputFormat: DateAllFormatString = 'date'): any {
|
|
215
219
|
const date = getDateAsObject(dateAllFormat)
|
|
216
220
|
date.setTime(date.getTime() + numberOfDays * 24 * 60 * 60 * 1000)
|
|
217
221
|
return getDateAs(date, outputFormat as any)
|
|
@@ -222,7 +226,7 @@ export function addDays(dateAllFormat: Date | string | number = getDateAsInt(),
|
|
|
222
226
|
*/
|
|
223
227
|
export function addMinutes(dateAllFormat?: Date | string | number, numberOfMinutes?: number, outputFormat?: DateStringFormats): string
|
|
224
228
|
export function addMinutes(dateAllFormat?: Date | string | number, numberOfMinutes?: number, outputFormat?: DateObjectFormat): Date
|
|
225
|
-
export function addMinutes(dateAllFormat:
|
|
229
|
+
export function addMinutes(dateAllFormat: DateAllFormat = getDateAsInt(), numberOfMinutes = 1, outputFormat: DateAllFormatString = 'date'): any {
|
|
226
230
|
const date = getDateAsObject(dateAllFormat)
|
|
227
231
|
date.setTime(date.getTime() + 1 * numberOfMinutes * 60 * 1000)
|
|
228
232
|
return getDateAs(date, outputFormat as any)
|
|
@@ -232,7 +236,7 @@ export function addMinutes(dateAllFormat: Date | string | number = getDateAsInt(
|
|
|
232
236
|
*/
|
|
233
237
|
export function addHours(dateAllFormat?: Date | string | number, numberOfHours?: number, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string
|
|
234
238
|
export function addHours(dateAllFormat?: Date | string | number, numberOfHours?: number, outputFormat?: 'date'): Date
|
|
235
|
-
export function addHours(dateAllFormat:
|
|
239
|
+
export function addHours(dateAllFormat: DateAllFormat = getDateAsInt(), numberOfHours = 1, outputFormat: DateAllFormatString = 'date'): any {
|
|
236
240
|
const date = getDateAsObject(dateAllFormat)
|
|
237
241
|
date.setTime(date.getTime() + 1 * numberOfHours * 60 * 60 * 1000)
|
|
238
242
|
return getDateAs(date, outputFormat as any)
|
|
@@ -242,7 +246,7 @@ export function addHours(dateAllFormat: Date | string | number = getDateAsInt(),
|
|
|
242
246
|
*/
|
|
243
247
|
export function addMonths(dateAllFormat?: Date | string | number, numberOfMonths?: number, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string
|
|
244
248
|
export function addMonths(dateAllFormat?: Date | string | number, numberOfMonths?: number, outputFormat?: 'date'): Date
|
|
245
|
-
export function addMonths(dateAllFormat:
|
|
249
|
+
export function addMonths(dateAllFormat: DateAllFormat = getDateAsInt(), numberOfMonths = 1, outputFormat: DateAllFormatString = 'date'): any {
|
|
246
250
|
const date = getDateAsObject(dateAllFormat)
|
|
247
251
|
date.setUTCMonth(date.getUTCMonth() + numberOfMonths)
|
|
248
252
|
return getDateAs(date, outputFormat as any)
|
|
@@ -250,32 +254,32 @@ export function addMonths(dateAllFormat: Date | string | number = getDateAsInt()
|
|
|
250
254
|
/**
|
|
251
255
|
* @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
|
|
252
256
|
*/
|
|
253
|
-
export function addYears(dateAllFormat:
|
|
257
|
+
export function addYears(dateAllFormat: DateAllFormat = getDateAsInt(), numberOfYears = 1, outputFormat: DateAllFormatString = 'date') {
|
|
254
258
|
const date = getDateAsObject(dateAllFormat)
|
|
255
259
|
date.setUTCFullYear(date.getUTCFullYear() + numberOfYears)
|
|
256
260
|
return getDateAs(date, outputFormat as any)
|
|
257
261
|
}
|
|
258
262
|
|
|
259
|
-
export function getDayOfMonth(dateAllFormat:
|
|
263
|
+
export function getDayOfMonth(dateAllFormat: DateAllFormat = getDateAsInt()) {
|
|
260
264
|
const dateAsInt = getDateAsInt(dateAllFormat)
|
|
261
265
|
const [, , d] = dateStringToArray(dateAsInt)
|
|
262
266
|
return d
|
|
263
267
|
}
|
|
264
268
|
|
|
265
|
-
export function getYear(dateAllFormat:
|
|
269
|
+
export function getYear(dateAllFormat: DateAllFormat = getDateAsInt()) {
|
|
266
270
|
const dateAsInt = getDateAsInt(dateAllFormat)
|
|
267
271
|
const [y] = dateStringToArray(dateAsInt)
|
|
268
272
|
return y
|
|
269
273
|
}
|
|
270
274
|
|
|
271
275
|
|
|
272
|
-
export function getHours(dateAllFormat:
|
|
276
|
+
export function getHours(dateAllFormat: DateAllFormat = getDateAsInt()) {
|
|
273
277
|
const dateAsInt = getDateAsInt(dateAllFormat)
|
|
274
278
|
const [, , , h] = dateStringToArray(dateAsInt)
|
|
275
279
|
return h
|
|
276
280
|
}
|
|
277
281
|
|
|
278
|
-
export function getMinutes(dateAllFormat:
|
|
282
|
+
export function getMinutes(dateAllFormat: DateAllFormat = getDateAsInt()) {
|
|
279
283
|
const dateAsInt = getDateAsInt(dateAllFormat)
|
|
280
284
|
const [, , , , m] = dateStringToArray(dateAsInt)
|
|
281
285
|
return m
|
|
@@ -284,7 +288,7 @@ export function getMinutes(dateAllFormat: Date | string | number = getDateAsInt(
|
|
|
284
288
|
/**
|
|
285
289
|
* @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
|
|
286
290
|
*/
|
|
287
|
-
export function lastDayOfMonth(dateAllFormat:
|
|
291
|
+
export function lastDayOfMonth(dateAllFormat: DateAllFormat = getDateAsInt(), outputFormat: DateAllFormatString = 'date') {
|
|
288
292
|
const date = getDateAsObject(dateAllFormat)
|
|
289
293
|
const lastDay = new Date(date.getUTCFullYear(), date.getUTCMonth() + 1, 0)
|
|
290
294
|
lastDay.setUTCHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds())
|
|
@@ -294,36 +298,36 @@ export function lastDayOfMonth(dateAllFormat: Date | string | number = getDateAs
|
|
|
294
298
|
/**
|
|
295
299
|
* @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
|
|
296
300
|
*/
|
|
297
|
-
export function firstDayOfMonth(dateAllFormat:
|
|
301
|
+
export function firstDayOfMonth(dateAllFormat: DateAllFormat = getDateAsInt(), outputFormat: DateAllFormatString = 'date') {
|
|
298
302
|
const date = getDateAsObject(dateAllFormat)
|
|
299
303
|
const firstDay = new Date(date.getUTCFullYear(), date.getUTCMonth(), 1)
|
|
300
304
|
firstDay.setUTCHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds())
|
|
301
305
|
return getDateAs(firstDay, outputFormat as any)
|
|
302
306
|
}
|
|
303
307
|
|
|
304
|
-
export function differenceInMilliseconds(startDateAllFormat, endDateAllFormat) {
|
|
308
|
+
export function differenceInMilliseconds(startDateAllFormat: any, endDateAllFormat: any) {
|
|
305
309
|
const startDate = getDateAsObject(startDateAllFormat)
|
|
306
310
|
const endDate = getDateAsObject(endDateAllFormat)
|
|
307
311
|
return endDate.getTime() - startDate.getTime()
|
|
308
312
|
}
|
|
309
313
|
|
|
310
|
-
export function differenceInSeconds(startDateAllFormat, endDateAllFormat) {
|
|
314
|
+
export function differenceInSeconds(startDateAllFormat: any, endDateAllFormat: any) {
|
|
311
315
|
return differenceInMilliseconds(startDateAllFormat, endDateAllFormat) / 1000
|
|
312
316
|
}
|
|
313
317
|
|
|
314
|
-
export function differenceInMinutes(startDateAllFormat, endDateAllFormat) {
|
|
318
|
+
export function differenceInMinutes(startDateAllFormat: any, endDateAllFormat: any) {
|
|
315
319
|
return differenceInSeconds(startDateAllFormat, endDateAllFormat) / 60
|
|
316
320
|
}
|
|
317
321
|
|
|
318
|
-
export function differenceInHours(startDateAllFormat, endDateAllFormat) {
|
|
322
|
+
export function differenceInHours(startDateAllFormat: any, endDateAllFormat: any) {
|
|
319
323
|
return differenceInMinutes(startDateAllFormat, endDateAllFormat) / 60
|
|
320
324
|
}
|
|
321
325
|
|
|
322
|
-
export function differenceInDays(startDateAllFormat, endDateAllFormat) {
|
|
326
|
+
export function differenceInDays(startDateAllFormat: any, endDateAllFormat: any) {
|
|
323
327
|
return differenceInHours(startDateAllFormat, endDateAllFormat) / 24
|
|
324
328
|
}
|
|
325
329
|
|
|
326
|
-
export function differenceInWeeks(startDateAllFormat, endDateAllFormat) {
|
|
330
|
+
export function differenceInWeeks(startDateAllFormat: any, endDateAllFormat: any) {
|
|
327
331
|
return differenceInDays(startDateAllFormat, endDateAllFormat) / 7
|
|
328
332
|
}
|
|
329
333
|
|
|
@@ -332,7 +336,7 @@ export function differenceInWeeks(startDateAllFormat, endDateAllFormat) {
|
|
|
332
336
|
*/
|
|
333
337
|
export function getDateAs(dateAllFormat?: Date | string | number, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string
|
|
334
338
|
export function getDateAs(dateAllFormat?: Date | string | number, outputFormat?: 'date'): Date
|
|
335
|
-
export function getDateAs(dateAllFormat:
|
|
339
|
+
export function getDateAs(dateAllFormat: DateAllFormat = new Date(), outputDateFormat: DateAllFormatString = 'date') {
|
|
336
340
|
switch (outputDateFormat) {
|
|
337
341
|
case 'dateInt8':
|
|
338
342
|
return getDateAsInt(dateAllFormat)
|
|
@@ -347,7 +351,7 @@ export function getDateAs(dateAllFormat: Date | string | number = new Date(), ou
|
|
|
347
351
|
}
|
|
348
352
|
|
|
349
353
|
|
|
350
|
-
export function isDateIntOrStringValid(dateStringOrInt, outputAnError = false, length
|
|
354
|
+
export function isDateIntOrStringValid(dateStringOrInt: DateAllFormat, outputAnError = false, length?: number): boolean {
|
|
351
355
|
if (!isset(dateStringOrInt)) return false
|
|
352
356
|
const dateStr = dateStringOrInt.toString()
|
|
353
357
|
|
|
@@ -355,7 +359,7 @@ export function isDateIntOrStringValid(dateStringOrInt, outputAnError = false, l
|
|
|
355
359
|
|
|
356
360
|
if ((typeof dateStringOrInt === 'object' && isNaN(int(dateStr))) || ![4, 6, 8, 10, 12, 17].includes(dateStr.length)) return false
|
|
357
361
|
|
|
358
|
-
const dateArr = dateStringToArray(dateStringOrInt)
|
|
362
|
+
const dateArr = dateStringToArray(dateStringOrInt as string)
|
|
359
363
|
const [y, M, d, h, m] = dateArr
|
|
360
364
|
|
|
361
365
|
const test1 = dateArr.length >= 3 && int(y) >= 1000 // Y
|
|
@@ -368,7 +372,7 @@ export function isDateIntOrStringValid(dateStringOrInt, outputAnError = false, l
|
|
|
368
372
|
return true
|
|
369
373
|
}
|
|
370
374
|
|
|
371
|
-
export function isDateIsoOrObjectValid(dateIsoOrObj, outputAnError = false) {
|
|
375
|
+
export function isDateIsoOrObjectValid(dateIsoOrObj: any, outputAnError = false) {
|
|
372
376
|
let dateObj: Date | number | string = dateIsoOrObj
|
|
373
377
|
if (typeof dateIsoOrObj === 'string') dateObj = new Date(dateIsoOrObj)
|
|
374
378
|
const valid = dateObj instanceof Date
|
package/src/env-utils.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//----------------------------------------
|
|
4
4
|
|
|
5
5
|
/** Parse one dimention object undefined, true, false, null represented as string will be converted to primitives */
|
|
6
|
-
export function parseEnv(env) {
|
|
6
|
+
export function parseEnv(env: Record<string, any>) {
|
|
7
7
|
const newEnv = {} as Record<string, undefined | null | number | boolean | string>
|
|
8
8
|
for (const k in env) {
|
|
9
9
|
const val = env[k]
|
package/src/error-utils.ts
CHANGED
|
@@ -12,15 +12,15 @@ import { removeCircularJSONstringify } from './remove-circular-json-stringify'
|
|
|
12
12
|
import { generateToken } from './string-utils'
|
|
13
13
|
import { isObject } from './is-object'
|
|
14
14
|
|
|
15
|
-
export function errIfNotSet(objOfVarNamesWithValues) { return errXXXIfNotSet(422, false, objOfVarNamesWithValues) }
|
|
15
|
+
export function errIfNotSet(objOfVarNamesWithValues: Record<string, any>) { return errXXXIfNotSet(422, false, objOfVarNamesWithValues) }
|
|
16
16
|
|
|
17
|
-
export function err500IfNotSet(objOfVarNamesWithValues) { return errXXXIfNotSet(500, false, objOfVarNamesWithValues) }
|
|
17
|
+
export function err500IfNotSet(objOfVarNamesWithValues: Record<string, any>) { return errXXXIfNotSet(500, false, objOfVarNamesWithValues) }
|
|
18
18
|
|
|
19
|
-
export function errIfEmptyOrNotSet(objOfVarNamesWithValues) { return errXXXIfNotSet(422, true, objOfVarNamesWithValues) }
|
|
19
|
+
export function errIfEmptyOrNotSet(objOfVarNamesWithValues: Record<string, any>) { return errXXXIfNotSet(422, true, objOfVarNamesWithValues) }
|
|
20
20
|
|
|
21
|
-
export function err500IfEmptyOrNotSet(objOfVarNamesWithValues) { return errXXXIfNotSet(500, true, objOfVarNamesWithValues) }
|
|
21
|
+
export function err500IfEmptyOrNotSet(objOfVarNamesWithValues: Record<string, any>) { return errXXXIfNotSet(500, true, objOfVarNamesWithValues) }
|
|
22
22
|
|
|
23
|
-
export function errXXXIfNotSet(errCode, checkEmpty, objOfVarNamesWithValues) {
|
|
23
|
+
export function errXXXIfNotSet(errCode: number, checkEmpty: boolean, objOfVarNamesWithValues: Record<string, any>) {
|
|
24
24
|
const missingVars: string[] = []
|
|
25
25
|
for (const prop in objOfVarNamesWithValues) {
|
|
26
26
|
if (!isset(objOfVarNamesWithValues[prop]) || (checkEmpty && isEmpty(objOfVarNamesWithValues[prop]))) missingVars.push(prop)
|
|
@@ -29,7 +29,7 @@ export function errXXXIfNotSet(errCode, checkEmpty, objOfVarNamesWithValues) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
export function err422IfNotSet(o) {
|
|
32
|
+
export function err422IfNotSet(o: Record<string, any>) {
|
|
33
33
|
const m: any[] = []
|
|
34
34
|
for (const p in o) if (!isset(o[p])) m.push(p)
|
|
35
35
|
if (m.length) throw new DescriptiveError(`requiredVariableEmptyOrNotSet`, { code: 422, origin: 'Validator', varNames: m.join(', ') })
|
|
@@ -48,7 +48,7 @@ export function tryCatch<T>(callback: () => T, onErr: Function = () => { /** */
|
|
|
48
48
|
|
|
49
49
|
export const failSafe = tryCatch // ALIAS
|
|
50
50
|
|
|
51
|
-
function extraInfosRendererDefault(extraInfos) {
|
|
51
|
+
function extraInfosRendererDefault(extraInfos: Record<string, any>) {
|
|
52
52
|
return [
|
|
53
53
|
'== EXTRA INFOS ==',
|
|
54
54
|
removeCircularJSONstringify({ ...extraInfos, message: undefined, stack: undefined, originalError: undefined, hasBeenLogged: undefined, logs: undefined }, 2)
|
|
@@ -224,6 +224,6 @@ export class DescriptiveError<ExpectedOriginalError = any> extends Error {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
function computeErrorMessage(err) {
|
|
227
|
+
function computeErrorMessage(err: any) {
|
|
228
228
|
return (err.code ? err.code + ' ' : '') + (err.msg || err.message)
|
|
229
229
|
}
|
package/src/isset.ts
CHANGED