topkat-utils 1.0.35 → 1.0.38

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### v1.0.37
2
+ * add generateObjectId
3
+ * cleaning and typing improvements
4
+
1
5
  ### v1.0.35
2
6
  * fix in asArray typing
3
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "topkat-utils",
3
- "version": "1.0.35",
3
+ "version": "1.0.38",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "description": "UTILS BIG TIME",
package/utils.d.ts CHANGED
@@ -5,6 +5,9 @@ declare const arrayUniqueValue: typeof noDuplicateFilter;
5
5
  declare const JSONstringyParse: (o: any) => any;
6
6
  declare const removeUndefinedKeys: typeof objFilterUndefinedRecursive;
7
7
  declare type Color = [number, number, number];
8
+ declare type ObjectGeneric = {
9
+ [k: string]: any;
10
+ };
8
11
  declare type BaseTypes = 'objectId' | 'dateInt6' | 'dateInt' | 'dateInt8' | 'dateInt12' | 'time' | 'humanReadableTimestamp' | 'date' | 'dateObject' | 'array' | 'object' | 'buffer' | 'string' | 'function' | 'boolean' | 'number' | 'bigint' | 'year' | 'email';
9
12
  /** Round with custom number of decimals (default:0) */
10
13
  declare function round(number: number, decimals?: number): number;
@@ -23,7 +26,7 @@ declare function moyenne(array: number[], nbOfDecimals?: number): number;
23
26
  /** Clean output for outside world. All undefined / null / NaN / Infinity values are changed to '-' */
24
27
  declare function cln(val: any, replacerInCaseItIsUndefinNaN?: string): any;
25
28
  /** length default 2, shortcut for 1 to 01 */
26
- declare function pad(numberOrStr: any, length?: number): string;
29
+ declare function pad(numberOrStr: number | string, length?: number): string;
27
30
  /** return the number or the closest number of the range
28
31
  * * nb min max => returns
29
32
  * * 7 5 10 => 7 // in the range
@@ -31,19 +34,20 @@ declare function pad(numberOrStr: any, length?: number): string;
31
34
  * * 99 5 10 => 10// above the max value
32
35
  */
33
36
  declare function minMax(nb: number, min: number, max: number): number;
34
- declare function tryCatch(callback: any, onErr?: Function): Promise<any>;
37
+ declare function tryCatch(callback: Function, onErr?: Function): Promise<any>;
35
38
  /** minLength 8 if unique
36
39
  * @param {Number} length default: 20
37
40
  * @param {Boolean} unique default: true. Generate a real unique token base on the date. min length will be min 8 in this case
38
41
  * @param {string} mode one of ['alphanumeric', 'hexadecimal']
39
42
  * NOTE: to generate a mongoDB Random Id, use the params: 24, true, 'hexadecimal'
40
43
  */
41
- declare function generateToken(length?: number, unique?: boolean, mode?: string): any;
44
+ declare function generateToken(length?: number, unique?: boolean, mode?: 'alphanumeric' | 'hexadecimal'): any;
45
+ declare function generateObjectId(): any;
42
46
  /** Useful to join differents bits of url with normalizing slashes
43
47
  * * urlPathJoin('https://', 'www.kikou.lol/', '/user', '//2//') => https://www.kikou.lol/user/2/
44
48
  * * urlPathJoin('http:/', 'kikou.lol') => https://www.kikou.lol
45
49
  */
46
- declare function urlPathJoin(...bits: any[]): string;
50
+ declare function urlPathJoin(...bits: string[]): string;
47
51
  /** path shall always be sorted before using in express
48
52
  * to avoid a generic route like /* to catch a specific one like /bonjour
49
53
  *
@@ -52,15 +56,18 @@ declare function urlPathJoin(...bits: any[]): string;
52
56
  * @return {Array} urls modified
53
57
  */
54
58
  declare function sortUrlsByDeepnessInArrayOrObject(urlObjOrArr: any, propInObjectOrIndexInArray: any): any;
55
- /**
56
- * Replace variables in a string like: `Hello {{userName}}!`
59
+ declare type MiniTemplaterOptions = {
60
+ valueWhenNotSet?: string;
61
+ regexp?: RegExp;
62
+ };
63
+ /** Replace variables in a string like: `Hello {{userName}}!`
57
64
  * @param {String} content
58
65
  * @param {Object} varz object with key => value === toReplace => replacer
59
66
  * @param {Object} options
60
67
  * * valueWhenNotSet => replacer for undefined values. Default: ''
61
68
  * * regexp => must be 'g' and first capturing group matching the value to replace. Default: /{{\s*([^}]*)\s*}}/g
62
69
  */
63
- declare function miniTemplater(content: any, varz: any, options: any): any;
70
+ declare function miniTemplater(content: string, varz: ObjectGeneric, options?: MiniTemplaterOptions): string;
64
71
  /**
65
72
  *
66
73
  * @param {Object} object main object
@@ -68,7 +75,7 @@ declare function miniTemplater(content: any, varz: any, options: any): any;
68
75
  * @param {Boolean} isMask default: true; determine the behavior of the function. If is mask, selected fields will not appear in the resulting object. If it's a select, only selected fields will appear.
69
76
  * @param {Boolean} deleteKeysInsteadOfReturningAnewObject default:false; modify the existing object instead of creating a new instance
70
77
  */
71
- declare function simpleObjectMaskOrSelect(object: any, maskedOrSelectedFields: any, isMask?: boolean, deleteKeysInsteadOfReturningAnewObject?: boolean): any;
78
+ declare function simpleObjectMaskOrSelect(object: ObjectGeneric, maskedOrSelectedFields: string[], isMask?: boolean, deleteKeysInsteadOfReturningAnewObject?: boolean): ObjectGeneric;
72
79
  /** READ ONLY, output a parsed version of process.env
73
80
  * use it like ENV().myVar
74
81
  */
@@ -128,23 +135,23 @@ declare function registerConfig(customConfig: any): void;
128
135
  * @param {Object} obj object to test against
129
136
  * @param {string} addr `a.b.c.0.1` will test if myObject has props a that has prop b. Work wit arrays as well (like `arr.0`)
130
137
  */
131
- declare function has(obj: object, addr: string): boolean;
138
+ declare function has(obj: ObjectGeneric, addr: string): boolean;
132
139
  /** Find address in an object "a.b.c" IN { a : { b : {c : 'blah' }}} RETURNS 'blah'
133
140
  * @param {object} obj
134
141
  * @param {string} addr accept syntax like "obj.subItem.[0].sub2" OR "obj.subItem.0.sub2" OR "obj.subItem[0].sub2"
135
142
  * @returns {any} the last item of the chain OR undefined if not found
136
143
  */
137
- declare function findByAddress(obj: object, addr: string): any;
144
+ declare function findByAddress(obj: ObjectGeneric, addr: string): any;
138
145
  /** Enforce writing subItems. Eg: user.name.blah will ensure all are set until the writing of the last item
139
146
  * NOTE: doesn't work with arrays
140
147
  */
141
- declare function objForceWrite(obj: object, addr: string, item: any): void;
148
+ declare function objForceWrite(obj: ObjectGeneric, addr: string, item: any): void;
142
149
  /** Enforce writing subItems, only if obj.addr is empty.
143
150
  * Eg: user.name.blah will ensure all are set until the writing of the last item
144
151
  * if user.name.blah has a value it will not change it.
145
152
  * NOTE: doesn't work with arrays
146
153
  */
147
- declare function objForceWriteIfNotSet(obj: object, addr: string, item: any): void;
154
+ declare function objForceWriteIfNotSet(obj: ObjectGeneric, addr: string, item: any): void;
148
155
  /** Merge mixins into class. Use it in the constructor like: mergeMixins(this, {myMixin: true}) */
149
156
  declare function mergeMixins(that: any, ...mixins: any[]): void;
150
157
  /** If a string is provided, return it as array else return the value */
@@ -156,7 +163,7 @@ declare function asArray<T extends any[] | any>(item: T): T extends undefined ?
156
163
  /** Array comparison
157
164
  * @return {object} { inCommon, notInB, notInA }
158
165
  */
159
- declare function compareArrays(arrayA?: any[], arrayB?: any[], compare?: (a: any, b: any) => boolean): {
166
+ declare function compareArrays(arrayA: any[], arrayB: any[], compare?: (a: any, b: any) => boolean): {
160
167
  inCommon: any[];
161
168
  notInB: any[];
162
169
  notInA: any[];
@@ -446,12 +453,12 @@ declare function isValid(...paramsToValidate: any[]): boolean;
446
453
  declare function isType(value: any, type: BaseTypes): boolean;
447
454
  declare function validatorReturnErrArray(...paramsToValidate: ValidatorObject[]): [string?, number?, object?];
448
455
  declare function isEmpty(objOrArr: object | any[] | string | null | undefined): boolean;
449
- declare function getDateAsInt12(dateAllFormat?: Date | string | number, errIfNotValid?: any): number;
456
+ declare function getDateAsInt12(dateAllFormat?: Date | string | number, errIfNotValid?: any): string;
450
457
  declare function humanReadableTimestamp(dateAllFormat: any): number;
451
458
  /** format for 6/8/2018 => 20180806
452
459
  * @param dateAllFormat multiple format allowed 2012, 20120101, 201201011200, new Date(), "2019-12-08T16:19:10.341Z" and all string that new Date() can parse
453
460
  */
454
- declare function getDateAsInt(dateAllFormat?: Date | string | number, errIfNotValid$?: boolean, withHoursAndMinutes$?: boolean): number;
461
+ declare function getDateAsInt(dateAllFormat?: Date | string | number, errIfNotValid$?: boolean, withHoursAndMinutes$?: boolean): string;
455
462
  declare function getMonthAsInt(dateAllFormat?: Date | string | number): number;
456
463
  /**
457
464
  * @param dateAllFormat multiple format allowed 2012, 20120101, 201201011200, new Date(), "2019-12-08T16:19:10.341Z" and all string that new Date() can parse
@@ -481,7 +488,7 @@ declare function getTimeAsInt(timeOrDateInt?: any): number | "dateInvalid";
481
488
  * @param {timeInt|dateInt12} Eg: 2222 OR 201201012222. Default, actual dateInt12
482
489
  * @param {String} separator default: ":"
483
490
  */
484
- declare function getIntAsTime(intOrDateTimeInt?: number, separator?: string): string;
491
+ declare function getIntAsTime(intOrDateTimeInt?: string, separator?: string): string;
485
492
  declare function isTimeStringValid(timeStr: any, outputAnError$?: boolean): boolean;
486
493
  declare function getDuration(startDate: any, endDate: any, inMinutes?: boolean): number | number[];
487
494
  /** compare two object with DATE INT, if they overlap return true
@@ -493,50 +500,28 @@ declare function getDuration(startDate: any, endDate: any, inMinutes?: boolean):
493
500
  * @param {Boolean} strict$ if true,
494
501
  */
495
502
  declare function doDateOverlap(event1: any, event2: any, fieldNameForStartDate$?: string, fieldNameForEndDate$?: string, allowNull$?: boolean, strict$?: boolean): boolean;
496
- /** Get all dates at specified days between two dates
497
- * @param daysArray [0,1,2,3,4,5,6]
498
- * @param {*} startDate all format
499
- * @param {*} endDate all format
500
- * @param {'int'|'object'} outputFormat default: int
501
- */
502
- declare function getDatesForDaysArrayBetweenTwoDates(daysArray: any, startDate: any, endDate: any, outputFormat?: string): (number | Date)[];
503
- declare function getEndTimeFromDurationAndStartTime(startTime: any, duration: any): {
504
- days: number;
505
- time: string;
506
- };
507
- declare function getDate12FromDateAndTime(dateAllFormat: Date | string | number, timeAllFormat: any): any;
508
- declare function eachDayOfInterval(startDateAllFormat: any, endDateAllFormat: any, outputFormat?: string): (number | Date)[];
509
- declare function eachMonthOfInterval(startDateAllFormat: any, endDateAllFormat: any): any[];
510
- declare function isSunday(dateAllFormat?: Date | string | number): boolean;
511
- declare function isMonday(dateAllFormat?: Date | string | number): boolean;
512
- declare function isTuesday(dateAllFormat?: Date | string | number): boolean;
513
- declare function isWednesday(dateAllFormat?: Date | string | number): boolean;
514
- declare function isThursday(dateAllFormat?: Date | string | number): boolean;
515
- declare function isFriday(dateAllFormat?: Date | string | number): boolean;
516
- declare function isSaturday(dateAllFormat?: Date | string | number): boolean;
517
- declare function isWeekend(dateAllFormat?: Date | string | number): boolean;
518
503
  declare function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp', sameDayAllowed?: boolean): number;
519
504
  declare function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: 'date', sameDayAllowed?: boolean): Date;
520
505
  /**
521
506
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
522
507
  */
523
- declare function addDays(dateAllFormat?: Date | string | number, numberOfDays?: number, outputFormat?: string): number | Date;
508
+ declare function addDays(dateAllFormat?: Date | string | number, numberOfDays?: number, outputFormat?: string): string | number | Date;
524
509
  /**
525
510
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
526
511
  */
527
- declare function addMinutes(dateAllFormat?: Date | string | number, numberOfMinutes?: number, outputFormat?: string): number | Date;
512
+ declare function addMinutes(dateAllFormat?: Date | string | number, numberOfMinutes?: number, outputFormat?: string): string | number | Date;
528
513
  /**
529
514
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
530
515
  */
531
- declare function addHours(dateAllFormat?: Date | string | number, numberOfHours?: number, outputFormat?: string): number | Date;
516
+ declare function addHours(dateAllFormat?: Date | string | number, numberOfHours?: number, outputFormat?: string): string | number | Date;
532
517
  /**
533
518
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
534
519
  */
535
- declare function addMonths(dateAllFormat?: Date | string | number, numberOfMonths?: number, outputFormat?: string): number | Date;
520
+ declare function addMonths(dateAllFormat?: Date | string | number, numberOfMonths?: number, outputFormat?: string): string | number | Date;
536
521
  /**
537
522
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
538
523
  */
539
- declare function addYears(dateAllFormat?: Date | string | number, numberOfYears?: number, outputFormat?: string): number | Date;
524
+ declare function addYears(dateAllFormat?: Date | string | number, numberOfYears?: number, outputFormat?: string): string | number | Date;
540
525
  declare function getDayOfMonth(dateAllFormat?: Date | string | number): any;
541
526
  declare function getYear(dateAllFormat?: Date | string | number): any;
542
527
  declare function getHours(dateAllFormat?: Date | string | number): any;
@@ -544,40 +529,17 @@ declare function getMinutes(dateAllFormat?: Date | string | number): any;
544
529
  /**
545
530
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
546
531
  */
547
- declare function lastDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: string): number | Date;
532
+ declare function lastDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: string): string | number | Date;
548
533
  /**
549
534
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
550
535
  */
551
- declare function firstDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: string): number | Date;
536
+ declare function firstDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: string): string | number | Date;
552
537
  declare function differenceInMilliseconds(startDateAllFormat: any, endDateAllFormat: any): number;
553
538
  declare function differenceInSeconds(startDateAllFormat: any, endDateAllFormat: any): number;
554
539
  declare function differenceInMinutes(startDateAllFormat: any, endDateAllFormat: any): number;
555
540
  declare function differenceInHours(startDateAllFormat: any, endDateAllFormat: any): number;
556
541
  declare function differenceInDays(startDateAllFormat: any, endDateAllFormat: any): number;
557
542
  declare function differenceInWeeks(startDateAllFormat: any, endDateAllFormat: any): number;
558
- declare function differenceInMonths(startDateAllFormat: any, endDateAllFormat: any): number;
559
- /** Will check if that date exists, and if not, this will
560
- * Usefull for monthly subscription or reccuring month dates
561
- * @param {any} dateAllFormat default: new Date()
562
- * @returns {Date} Date object
563
- */
564
- declare function getClosestExistingDateOfMonth(dateAllFormat?: Date | string | number): any;
565
- /** Compute the best possible date for next month same day
566
- * Usefull for monthly subscription or reccuring month dates
567
- * @param {any} dateAllFormat default: new Date()
568
- * @param {Boolean} onlyFuture if true return the future date relative to any date in the past, else, it return the next month date possible relative to the dateAllFormat
569
- * @returns {Date} Date object
570
- */
571
- declare function getNextMonthlyDate(dateAllFormat?: Date | string | number, onlyFuture?: boolean): any;
572
- declare function getHolidayReferenceYear(dateAllFormat: Date | string | number): number;
573
- /**
574
- * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
575
- */
576
- declare function getFirstDayOfHolidayReferenceYear(dateAllFormat: Date | string | number, outputFormat?: string): number | Date;
577
- /**
578
- * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
579
- */
580
- declare function getLastDayOfHolidayReferenceYear(dateAllFormat: Date | string | number, outputFormat?: string): number | Date;
581
543
  /**
582
544
  // console colored output
583
545
  // * console.log(C.green(C.dim('Hey bro !')))
@@ -714,6 +676,7 @@ declare const _: {
714
676
  sortUrlsByDeepnessInArrayOrObject: typeof sortUrlsByDeepnessInArrayOrObject;
715
677
  urlPathJoin: typeof urlPathJoin;
716
678
  miniTemplater: typeof miniTemplater;
679
+ generateObjectId: typeof generateObjectId;
717
680
  isBetween: typeof isBetween;
718
681
  simpleObjectMaskOrSelect: typeof simpleObjectMaskOrSelect;
719
682
  ENV: typeof ENV;
@@ -823,18 +786,7 @@ declare const _: {
823
786
  isTimeStringValid: typeof isTimeStringValid;
824
787
  getDuration: typeof getDuration;
825
788
  doDateOverlap: typeof doDateOverlap;
826
- getDatesForDaysArrayBetweenTwoDates: typeof getDatesForDaysArrayBetweenTwoDates;
827
- getEndTimeFromDurationAndStartTime: typeof getEndTimeFromDurationAndStartTime;
828
- getDate12FromDateAndTime: typeof getDate12FromDateAndTime;
829
789
  getMonthAsInt: typeof getMonthAsInt;
830
- isSunday: typeof isSunday;
831
- isMonday: typeof isMonday;
832
- isTuesday: typeof isTuesday;
833
- isWednesday: typeof isWednesday;
834
- isThursday: typeof isThursday;
835
- isFriday: typeof isFriday;
836
- isSaturday: typeof isSaturday;
837
- isWeekend: typeof isWeekend;
838
790
  nextWeekDay: typeof nextWeekDay;
839
791
  addMinutes: typeof addMinutes;
840
792
  addHours: typeof addHours;
@@ -847,20 +799,12 @@ declare const _: {
847
799
  getMinutes: typeof getMinutes;
848
800
  firstDayOfMonth: typeof firstDayOfMonth;
849
801
  lastDayOfMonth: typeof lastDayOfMonth;
850
- eachDayOfInterval: typeof eachDayOfInterval;
851
- eachMonthOfInterval: typeof eachMonthOfInterval;
852
802
  differenceInMilliseconds: typeof differenceInMilliseconds;
853
803
  differenceInSeconds: typeof differenceInSeconds;
854
804
  differenceInMinutes: typeof differenceInMinutes;
855
805
  differenceInHours: typeof differenceInHours;
856
806
  differenceInDays: typeof differenceInDays;
857
807
  differenceInWeeks: typeof differenceInWeeks;
858
- differenceInMonths: typeof differenceInMonths;
859
- getClosestExistingDateOfMonth: typeof getClosestExistingDateOfMonth;
860
- getNextMonthlyDate: typeof getNextMonthlyDate;
861
- getHolidayReferenceYear: typeof getHolidayReferenceYear;
862
- getFirstDayOfHolidayReferenceYear: typeof getFirstDayOfHolidayReferenceYear;
863
- getLastDayOfHolidayReferenceYear: typeof getLastDayOfHolidayReferenceYear;
864
808
  getDateAsArrayFormatted: typeof dateArray;
865
809
  getDateAsArray: typeof dateStringToArray;
866
810
  convertDateAsInt: typeof getDateAsInt;
@@ -926,6 +870,6 @@ declare const _: {
926
870
  tryCatch: typeof tryCatch;
927
871
  };
928
872
  export default _;
929
- export { round, random, cln, pad, int, minMax, generateToken, moyenne, average, sumArray, sortUrlsByDeepnessInArrayOrObject, urlPathJoin, miniTemplater, isBetween, simpleObjectMaskOrSelect, ENV, parseBool, registerConfig, configFn, findByAddress, objForceWrite, objForceWriteIfNotSet, strAsArray, asArray, compareArrays, getArrayInCommon, getArrayDiff, getNotInArrayA, noDuplicateFilter, arrayCount, arrayToObjectSorted, pushIfNotExist, isNotEmptyArray, randomItemInArray, arrayUniqueValue, deepClone, cloneObject, JSONstringyParse, has, isObject, mergeDeep, flattenObject, unflattenObject, recursiveGenericFunction, recursiveGenericFunctionSync, findByAddressAll, objFilterUndefined, readOnly, reassignForbidden, readOnlyForAll, mergeDeepOverrideArrays, mergeDeepConfigurable, objFilterUndefinedRecursive, removeUndefinedKeys, // alias
873
+ export { round, random, cln, pad, int, minMax, generateToken, moyenne, average, sumArray, sortUrlsByDeepnessInArrayOrObject, urlPathJoin, miniTemplater, generateObjectId, isBetween, simpleObjectMaskOrSelect, ENV, parseBool, registerConfig, configFn, findByAddress, objForceWrite, objForceWriteIfNotSet, strAsArray, asArray, compareArrays, getArrayInCommon, getArrayDiff, getNotInArrayA, noDuplicateFilter, arrayCount, arrayToObjectSorted, pushIfNotExist, isNotEmptyArray, randomItemInArray, arrayUniqueValue, deepClone, cloneObject, JSONstringyParse, has, isObject, mergeDeep, flattenObject, unflattenObject, recursiveGenericFunction, recursiveGenericFunctionSync, findByAddressAll, objFilterUndefined, readOnly, reassignForbidden, readOnlyForAll, mergeDeepOverrideArrays, mergeDeepConfigurable, objFilterUndefinedRecursive, removeUndefinedKeys, // alias
930
874
  sortObjKeyAccordingToValue, ensureObjectProp, filterKeys, deleteByAddress, ensureIsArrayAndPush, removeCircularJSONstringify, isset, cleanStackTrace, shuffleArray, shuffleArray as randomizeArray, round2, camelCase, snakeCase, kebabCase, kebabCase as dashCase, snakeCase as underscoreCase, titleCase, pascalCase, lowerCase, upperCase, capitalize1st, camelCaseToWords, firstMatch, allMatches, getValuesBetweenSeparator, getValuesBetweenStrings, escapeRegexp, validator, validator as required, // alias for readability
931
- validatorReturnErrArray, assert, restTestMini, isValid, isType, isDateObject, issetOr, isEmptyOrNotSet, errIfNotSet, err500IfNotSet, errIfEmptyOrNotSet, err500IfEmptyOrNotSet, errXXXIfNotSet, isEmpty, checkAllObjectValuesAreEmpty, checkCtxIntegrity, issetOr as orIsset, getDateAsInt12, humanReadableTimestamp, getDateAsInt, getDateAsObject, isDateIntOrStringValid, isDateIsoOrObjectValid, dateStringToArray, dateArray, dateArrayInt, dateFormatted as dateSlash, dateFormatted, dateOffset, getTimeAsInt, getIntAsTime, isTimeStringValid, getDuration, doDateOverlap, getDatesForDaysArrayBetweenTwoDates, getEndTimeFromDurationAndStartTime, getDate12FromDateAndTime, getMonthAsInt, isSunday, isMonday, isTuesday, isWednesday, isThursday, isFriday, isSaturday, isWeekend, nextWeekDay, addMinutes, addHours, addDays, addMonths, addYears, getYear, getDayOfMonth, getHours, getMinutes, firstDayOfMonth, lastDayOfMonth, eachDayOfInterval, eachMonthOfInterval, differenceInMilliseconds, differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays, differenceInWeeks, differenceInMonths, getClosestExistingDateOfMonth, getNextMonthlyDate, getHolidayReferenceYear, getFirstDayOfHolidayReferenceYear, getLastDayOfHolidayReferenceYear, getDateAsInt as convertDateAsInt, getDateAsObject as convertDateAsObject, C, cliProgressBar, cliLoadingSpinner, convertAccentedCharacters, executeInDelayedLoop, timeout, runAsync, waitUntilTrue, transaction, waitForTransaction, getId, mergeMixins, mongoFilterMerger, mongoPush, tryCatch, };
875
+ validatorReturnErrArray, assert, restTestMini, isValid, isType, isDateObject, issetOr, isEmptyOrNotSet, errIfNotSet, err500IfNotSet, errIfEmptyOrNotSet, err500IfEmptyOrNotSet, errXXXIfNotSet, isEmpty, checkAllObjectValuesAreEmpty, checkCtxIntegrity, issetOr as orIsset, getDateAsInt12, humanReadableTimestamp, getDateAsInt, getDateAsObject, isDateIntOrStringValid, isDateIsoOrObjectValid, dateStringToArray, dateArray, dateArrayInt, dateFormatted as dateSlash, dateFormatted, dateOffset, getTimeAsInt, getIntAsTime, isTimeStringValid, getDuration, doDateOverlap, getMonthAsInt, nextWeekDay, addMinutes, addHours, addDays, addMonths, addYears, getYear, getDayOfMonth, getHours, getMinutes, firstDayOfMonth, lastDayOfMonth, differenceInMilliseconds, differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays, differenceInWeeks, getDateAsInt as convertDateAsInt, getDateAsObject as convertDateAsObject, C, cliProgressBar, cliLoadingSpinner, convertAccentedCharacters, executeInDelayedLoop, timeout, runAsync, waitUntilTrue, transaction, waitForTransaction, getId, mergeMixins, mongoFilterMerger, mongoPush, tryCatch, };
package/utils.js CHANGED
@@ -61,12 +61,14 @@ function generateToken(length = 20, unique = true, mode = 'alphanumeric') {
61
61
  while (token.length < length)
62
62
  token += Math.random().toString(charConvNumeric).substr(2, 1); // char alphaNumeric aléatoire
63
63
  } while (generatedTokens.includes(token));
64
- if (lastTs < tokenTs) {
64
+ if (lastTs < tokenTs)
65
65
  generatedTokens = []; // reset generated token on new timestamp because cannot collide
66
- }
67
66
  generatedTokens.push(token);
68
67
  return token;
69
68
  }
69
+ function generateObjectId() {
70
+ return generateToken(24, true, 'hexadecimal');
71
+ }
70
72
  /** Useful to join differents bits of url with normalizing slashes
71
73
  * * urlPathJoin('https://', 'www.kikou.lol/', '/user', '//2//') => https://www.kikou.lol/user/2/
72
74
  * * urlPathJoin('http:/', 'kikou.lol') => https://www.kikou.lol
@@ -103,15 +105,14 @@ function sortUrlsByDeepnessInArrayOrObject(urlObjOrArr, propInObjectOrIndexInArr
103
105
  bUrl.length - aUrl.length; // help separating / vs /blah
104
106
  });
105
107
  }
106
- /**
107
- * Replace variables in a string like: `Hello {{userName}}!`
108
+ /** Replace variables in a string like: `Hello {{userName}}!`
108
109
  * @param {String} content
109
110
  * @param {Object} varz object with key => value === toReplace => replacer
110
111
  * @param {Object} options
111
112
  * * valueWhenNotSet => replacer for undefined values. Default: ''
112
113
  * * regexp => must be 'g' and first capturing group matching the value to replace. Default: /{{\s*([^}]*)\s*}}/g
113
114
  */
114
- function miniTemplater(content, varz, options) {
115
+ function miniTemplater(content, varz, options = {}) {
115
116
  options = {
116
117
  valueWhenNotSet: '',
117
118
  regexp: /{{\s*([^}]*)\s*}}/g,
@@ -353,7 +354,7 @@ function asArray(item) {
353
354
  /** Array comparison
354
355
  * @return {object} { inCommon, notInB, notInA }
355
356
  */
356
- function compareArrays(arrayA = [], arrayB = [], compare = (a, b) => a === b) {
357
+ function compareArrays(arrayA, arrayB, compare = (a, b) => a === b) {
357
358
  return {
358
359
  inCommon: getArrayInCommon(arrayA, arrayB, compare),
359
360
  notInB: getNotInArrayA(arrayB, arrayA, compare),
@@ -1006,6 +1007,9 @@ function validator(...paramsToValidate) {
1006
1007
  }
1007
1008
  const restTestMini = {
1008
1009
  reset() {
1010
+ restTestMini.nbSuccess = 0;
1011
+ restTestMini.nbError = 0;
1012
+ restTestMini.lastErrors = [];
1009
1013
  },
1010
1014
  printStats() {
1011
1015
  // TODO print last errz
@@ -1220,7 +1224,12 @@ function humanReadableTimestamp(dateAllFormat) {
1220
1224
  */
1221
1225
  function getDateAsInt(dateAllFormat = new Date(), errIfNotValid$ = false, withHoursAndMinutes$ = false) {
1222
1226
  let dateInt;
1223
- if (isDateIntOrStringValid(dateAllFormat)) {
1227
+ if (typeof dateAllFormat === 'string' && dateAllFormat.includes('/')) {
1228
+ // 01/01/2020 format
1229
+ const [d, m, y] = dateAllFormat.split('/');
1230
+ return y + m.toString().padStart(2, '0') + d.toString().padStart(2, '0');
1231
+ }
1232
+ else if (isDateIntOrStringValid(dateAllFormat)) {
1224
1233
  // we can pass an int or string format (20180106)
1225
1234
  dateInt = (dateAllFormat + '00000000').substr(0, 12); // add default 000000 for "month days minutes:sec" if not set
1226
1235
  }
@@ -1406,92 +1415,6 @@ function doDateOverlap(event1, event2, fieldNameForStartDate$ = 'startDate', fie
1406
1415
  return (!event2[fieldNameForEndDate$] || event1[fieldNameForStartDate$] < event2[fieldNameForEndDate$]) && (!event1[fieldNameForEndDate$] || event1[fieldNameForEndDate$] > event2[fieldNameForStartDate$]);
1407
1416
  return (!event2[fieldNameForEndDate$] || event1[fieldNameForStartDate$] <= event2[fieldNameForEndDate$]) && (!event1[fieldNameForEndDate$] || event1[fieldNameForEndDate$] >= event2[fieldNameForStartDate$]);
1408
1417
  }
1409
- /** Get all dates at specified days between two dates
1410
- * @param daysArray [0,1,2,3,4,5,6]
1411
- * @param {*} startDate all format
1412
- * @param {*} endDate all format
1413
- * @param {'int'|'object'} outputFormat default: int
1414
- */
1415
- function getDatesForDaysArrayBetweenTwoDates(daysArray, startDate, endDate, outputFormat = 'int') {
1416
- const dateArr = [];
1417
- let actualDate = getDateAsObject(startDate);
1418
- endDate = getDateAsObject(endDate);
1419
- while (actualDate <= endDate) {
1420
- if (daysArray.includes(actualDate.getUTCDay()))
1421
- dateArr.push(getDateAsObject(actualDate)); // cloned
1422
- actualDate.setUTCDate(actualDate.getUTCDate() + 1);
1423
- }
1424
- return dateArr.map(d => getDateAs(d, outputFormat));
1425
- }
1426
- function getEndTimeFromDurationAndStartTime(startTime, duration) {
1427
- const timeArr = startTime.split(':').map(n => parseInt(n));
1428
- let endTime = (timeArr[0] * 60 + timeArr[1]) + duration;
1429
- return {
1430
- days: Math.floor(endTime / 1440),
1431
- time: pad(Math.floor((endTime % 1440) / 60)) + ':' + pad(endTime % 60)
1432
- };
1433
- }
1434
- function getDate12FromDateAndTime(dateAllFormat, timeAllFormat) {
1435
- if (typeof dateAllFormat !== 'number' || dateAllFormat > 99991231 || dateAllFormat < 0)
1436
- dateAllFormat = getDateAsInt(dateAllFormat);
1437
- if (typeof timeAllFormat !== 'number' || timeAllFormat > 2359 || timeAllFormat < 0)
1438
- timeAllFormat = getTimeAsInt(timeAllFormat);
1439
- return dateAllFormat * 10000 + timeAllFormat;
1440
- }
1441
- function eachDayOfInterval(startDateAllFormat, endDateAllFormat, outputFormat = 'int') {
1442
- const start = getDateAsObject(startDateAllFormat);
1443
- const end = getDateAsObject(endDateAllFormat);
1444
- let days = [];
1445
- let current = new Date();
1446
- current.setTime(start.getTime());
1447
- while (current <= end) {
1448
- days.push(new Date(current.getTime()));
1449
- current.setTime(current.getTime() + 1000 * 60 * 60 * 24);
1450
- }
1451
- return days.map(d => getDateAs(d, outputFormat));
1452
- }
1453
- function eachMonthOfInterval(startDateAllFormat, endDateAllFormat) {
1454
- const months = [];
1455
- const current = firstDayOfMonth(startDateAllFormat, 'Object');
1456
- const end = firstDayOfMonth(endDateAllFormat, 'Object');
1457
- while (current <= end) {
1458
- months.push(getMonthAsInt(current));
1459
- current.setUTCMonth(current.getUTCMonth() + 1);
1460
- }
1461
- return months;
1462
- }
1463
- function isSunday(dateAllFormat = getDateAsInt()) {
1464
- let date = getDateAsObject(dateAllFormat);
1465
- return date.getUTCDay() === 0;
1466
- }
1467
- function isMonday(dateAllFormat = getDateAsInt()) {
1468
- let date = getDateAsObject(dateAllFormat);
1469
- return date.getUTCDay() === 1;
1470
- }
1471
- function isTuesday(dateAllFormat = getDateAsInt()) {
1472
- let date = getDateAsObject(dateAllFormat);
1473
- return date.getUTCDay() === 2;
1474
- }
1475
- function isWednesday(dateAllFormat = getDateAsInt()) {
1476
- let date = getDateAsObject(dateAllFormat);
1477
- return date.getUTCDay() === 3;
1478
- }
1479
- function isThursday(dateAllFormat = getDateAsInt()) {
1480
- let date = getDateAsObject(dateAllFormat);
1481
- return date.getUTCDay() === 4;
1482
- }
1483
- function isFriday(dateAllFormat = getDateAsInt()) {
1484
- let date = getDateAsObject(dateAllFormat);
1485
- return date.getUTCDay() === 5;
1486
- }
1487
- function isSaturday(dateAllFormat = getDateAsInt()) {
1488
- let date = getDateAsObject(dateAllFormat);
1489
- return date.getUTCDay() === 6;
1490
- }
1491
- function isWeekend(dateAllFormat = getDateAsInt()) {
1492
- let date = getDateAsObject(dateAllFormat);
1493
- return date.getUTCDay() === 6 || date.getUTCDay() === 0;
1494
- }
1495
1418
  function nextWeekDay(fromDate, weekDayInt, outputFormat = 'date', sameDayAllowed = false) {
1496
1419
  const date = getDateAsObject(fromDate);
1497
1420
  if (!isset(weekDayInt))
@@ -1603,103 +1526,6 @@ function differenceInDays(startDateAllFormat, endDateAllFormat) {
1603
1526
  function differenceInWeeks(startDateAllFormat, endDateAllFormat) {
1604
1527
  return differenceInDays(startDateAllFormat, endDateAllFormat) / 7;
1605
1528
  }
1606
- function differenceInMonths(startDateAllFormat, endDateAllFormat) {
1607
- const startDate = getDateAsInt(startDateAllFormat);
1608
- const endDate = getDateAsInt(endDateAllFormat);
1609
- const monthesForStart = parseInt(getYear(startDate)) * 12 + parseInt(getMonthForHuman(startDate));
1610
- const monthesForEnd = parseInt(getYear(endDate)) * 12 + parseInt(getMonthForHuman(endDate));
1611
- if (monthesForStart === monthesForEnd) {
1612
- const firstDay = firstDayOfMonth(startDate);
1613
- const lastDay = lastDayOfMonth(endDate);
1614
- const differenceBetweenStartAndEnd = differenceInDays(startDate, endDate);
1615
- const numberOfDaysInMonth = differenceInDays(firstDay, lastDay);
1616
- return round(differenceBetweenStartAndEnd / numberOfDaysInMonth, 2);
1617
- }
1618
- const firstDayOfStartDateMonth = firstDayOfMonth(startDate);
1619
- const lastDayOfStartDateMonth = lastDayOfMonth(startDate);
1620
- const firstDayOfEndDateMonth = firstDayOfMonth(endDate);
1621
- const lastDayOfEndDateMonth = lastDayOfMonth(endDate);
1622
- const differenceBetweenStartDateAndEndOfStartMonth = differenceInDays(startDate, lastDayOfStartDateMonth);
1623
- const differenceBetweenStartOfEndMonthAndEndDate = differenceInDays(firstDayOfEndDateMonth, endDate);
1624
- const numberOfDaysInStartMonth = differenceInDays(firstDayOfStartDateMonth, lastDayOfStartDateMonth);
1625
- const numberOfDaysInEndMonth = differenceInDays(firstDayOfEndDateMonth, lastDayOfEndDateMonth);
1626
- return round(monthesForEnd - monthesForStart - 1 + differenceBetweenStartDateAndEndOfStartMonth / numberOfDaysInStartMonth + differenceBetweenStartOfEndMonthAndEndDate / numberOfDaysInEndMonth, 2);
1627
- }
1628
- /** Will check if that date exists, and if not, this will
1629
- * Usefull for monthly subscription or reccuring month dates
1630
- * @param {any} dateAllFormat default: new Date()
1631
- * @returns {Date} Date object
1632
- */
1633
- function getClosestExistingDateOfMonth(dateAllFormat = getDateAsInt()) {
1634
- let [day, month, year] = dateArrayInt(dateAllFormat);
1635
- const zeroBasedMonth = minMax(month - 1, 0, 11);
1636
- if (!isBetween(month, 1, 12))
1637
- console.error('Wrong month provided for getClosestExistingDateOfMonth: ' + month + ' Shall be between 1-12. Converted to ' + zeroBasedMonth);
1638
- let dayNb = minMax(day, 1, 31);
1639
- let date;
1640
- let increment = dayNb < 1;
1641
- let tooMuchRecursionCount = 0;
1642
- do
1643
- date = new Date(year, zeroBasedMonth, (increment ? dayNb++ : dayNb--), 12);
1644
- while (date.getUTCMonth() !== zeroBasedMonth && tooMuchRecursionCount < 99);
1645
- if (tooMuchRecursionCount)
1646
- throw new dataValidationUtilErrorHandler(`tooMuchRecursionCount`, 500, { origin: 'getClosestExistingDateOfMonth', day, month, year });
1647
- return date;
1648
- }
1649
- /** Compute the best possible date for next month same day
1650
- * Usefull for monthly subscription or reccuring month dates
1651
- * @param {any} dateAllFormat default: new Date()
1652
- * @param {Boolean} onlyFuture if true return the future date relative to any date in the past, else, it return the next month date possible relative to the dateAllFormat
1653
- * @returns {Date} Date object
1654
- */
1655
- function getNextMonthlyDate(dateAllFormat = getDateAsInt(), onlyFuture = false) {
1656
- let [day, month, year] = dateArrayInt(dateAllFormat);
1657
- day = minMax(day, 1, 31);
1658
- month = minMax(month, 1, 12);
1659
- err422IfNotSet({ year, month, day });
1660
- const isDatePast = getDateAsInt(dateAllFormat) <= getDateAsInt();
1661
- if (onlyFuture && isDatePast) {
1662
- let [, todayMonth, todayYear] = dateArrayInt();
1663
- month = todayMonth;
1664
- year = todayYear;
1665
- }
1666
- let nextMonth;
1667
- if (month === 12) {
1668
- nextMonth = 1;
1669
- year++;
1670
- }
1671
- else
1672
- nextMonth = month + 1;
1673
- return getClosestExistingDateOfMonth(new Date(year, nextMonth - 1, day));
1674
- }
1675
- function getHolidayReferenceYear(dateAllFormat) {
1676
- let date = getDateAsObject(dateAllFormat);
1677
- if (date.getUTCMonth() > 4)
1678
- return date.getUTCFullYear();
1679
- return date.getUTCFullYear() - 1;
1680
- }
1681
- /**
1682
- * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
1683
- */
1684
- function getFirstDayOfHolidayReferenceYear(dateAllFormat, outputFormat = 'int') {
1685
- const date = getDateAsObject(dateAllFormat);
1686
- let year = date.getUTCFullYear();
1687
- if (date.getUTCMonth() < 4)
1688
- year = date.getUTCFullYear() - 1;
1689
- const firstDayAsInt = year + '0601';
1690
- return getDateAs(firstDayAsInt, outputFormat);
1691
- }
1692
- /**
1693
- * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
1694
- */
1695
- function getLastDayOfHolidayReferenceYear(dateAllFormat, outputFormat = 'int') {
1696
- let date = getDateAsObject(dateAllFormat);
1697
- let year = date.getUTCFullYear() + 1;
1698
- if (date.getUTCMonth() < 4)
1699
- year = date.getUTCFullYear();
1700
- const firstDayAsInt = year + '0531';
1701
- return getDateAs(firstDayAsInt, outputFormat);
1702
- }
1703
1529
  /**
1704
1530
  * @param {String} outputDateFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
1705
1531
  */
@@ -2243,6 +2069,7 @@ const _ = {
2243
2069
  sortUrlsByDeepnessInArrayOrObject,
2244
2070
  urlPathJoin,
2245
2071
  miniTemplater,
2072
+ generateObjectId,
2246
2073
  isBetween,
2247
2074
  simpleObjectMaskOrSelect,
2248
2075
  ENV,
@@ -2349,18 +2176,7 @@ const _ = {
2349
2176
  isTimeStringValid,
2350
2177
  getDuration,
2351
2178
  doDateOverlap,
2352
- getDatesForDaysArrayBetweenTwoDates,
2353
- getEndTimeFromDurationAndStartTime,
2354
- getDate12FromDateAndTime,
2355
2179
  getMonthAsInt,
2356
- isSunday,
2357
- isMonday,
2358
- isTuesday,
2359
- isWednesday,
2360
- isThursday,
2361
- isFriday,
2362
- isSaturday,
2363
- isWeekend,
2364
2180
  nextWeekDay,
2365
2181
  addMinutes,
2366
2182
  addHours,
@@ -2373,20 +2189,12 @@ const _ = {
2373
2189
  getMinutes,
2374
2190
  firstDayOfMonth,
2375
2191
  lastDayOfMonth,
2376
- eachDayOfInterval,
2377
- eachMonthOfInterval,
2378
2192
  differenceInMilliseconds,
2379
2193
  differenceInSeconds,
2380
2194
  differenceInMinutes,
2381
2195
  differenceInHours,
2382
2196
  differenceInDays,
2383
2197
  differenceInWeeks,
2384
- differenceInMonths,
2385
- getClosestExistingDateOfMonth,
2386
- getNextMonthlyDate,
2387
- getHolidayReferenceYear,
2388
- getFirstDayOfHolidayReferenceYear,
2389
- getLastDayOfHolidayReferenceYear,
2390
2198
  // ALIASES
2391
2199
  getDateAsArrayFormatted: dateArray,
2392
2200
  getDateAsArray: dateStringToArray,
@@ -2417,7 +2225,7 @@ const _ = {
2417
2225
  export default _;
2418
2226
  export { round, random, cln, pad,
2419
2227
  // ALIASES
2420
- int, minMax, generateToken, moyenne, average, sumArray, sortUrlsByDeepnessInArrayOrObject, urlPathJoin, miniTemplater, isBetween, simpleObjectMaskOrSelect, ENV, parseBool, registerConfig, configFn, findByAddress, objForceWrite, objForceWriteIfNotSet, strAsArray, asArray, compareArrays, getArrayInCommon, getArrayDiff, getNotInArrayA, noDuplicateFilter, arrayCount, arrayToObjectSorted, pushIfNotExist, isNotEmptyArray, randomItemInArray,
2228
+ int, minMax, generateToken, moyenne, average, sumArray, sortUrlsByDeepnessInArrayOrObject, urlPathJoin, miniTemplater, generateObjectId, isBetween, simpleObjectMaskOrSelect, ENV, parseBool, registerConfig, configFn, findByAddress, objForceWrite, objForceWriteIfNotSet, strAsArray, asArray, compareArrays, getArrayInCommon, getArrayDiff, getNotInArrayA, noDuplicateFilter, arrayCount, arrayToObjectSorted, pushIfNotExist, isNotEmptyArray, randomItemInArray,
2421
2229
  //allias
2422
2230
  arrayUniqueValue, deepClone, cloneObject, JSONstringyParse, has, isObject, mergeDeep, flattenObject, unflattenObject, recursiveGenericFunction, recursiveGenericFunctionSync, findByAddressAll, objFilterUndefined, readOnly, reassignForbidden, readOnlyForAll, mergeDeepOverrideArrays, mergeDeepConfigurable, objFilterUndefinedRecursive, removeUndefinedKeys, // alias
2423
2231
  sortObjKeyAccordingToValue, ensureObjectProp, filterKeys, deleteByAddress, ensureIsArrayAndPush, removeCircularJSONstringify, isset, cleanStackTrace, shuffleArray, shuffleArray as randomizeArray, round2, camelCase, snakeCase, kebabCase, kebabCase as dashCase, snakeCase as underscoreCase, titleCase, pascalCase, lowerCase, upperCase, capitalize1st, camelCaseToWords, firstMatch, allMatches, getValuesBetweenSeparator, getValuesBetweenStrings, escapeRegexp, validator, validator as required, // alias for readability
@@ -2427,7 +2235,7 @@ issetOr as orIsset,
2427
2235
  // DATE
2428
2236
  getDateAsInt12, humanReadableTimestamp, getDateAsInt, getDateAsObject, isDateIntOrStringValid, isDateIsoOrObjectValid, dateStringToArray, dateArray, dateArrayInt, dateFormatted as dateSlash, dateFormatted, dateOffset, getTimeAsInt, getIntAsTime, isTimeStringValid,
2429
2237
  // isDateObject <= see validator.js
2430
- getDuration, doDateOverlap, getDatesForDaysArrayBetweenTwoDates, getEndTimeFromDurationAndStartTime, getDate12FromDateAndTime, getMonthAsInt, isSunday, isMonday, isTuesday, isWednesday, isThursday, isFriday, isSaturday, isWeekend, nextWeekDay, addMinutes, addHours, addDays, addMonths, addYears, getYear, getDayOfMonth, getHours, getMinutes, firstDayOfMonth, lastDayOfMonth, eachDayOfInterval, eachMonthOfInterval, differenceInMilliseconds, differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays, differenceInWeeks, differenceInMonths, getClosestExistingDateOfMonth, getNextMonthlyDate, getHolidayReferenceYear, getFirstDayOfHolidayReferenceYear, getLastDayOfHolidayReferenceYear,
2238
+ getDuration, doDateOverlap, getMonthAsInt, nextWeekDay, addMinutes, addHours, addDays, addMonths, addYears, getYear, getDayOfMonth, getHours, getMinutes, firstDayOfMonth, lastDayOfMonth, differenceInMilliseconds, differenceInSeconds, differenceInMinutes, differenceInHours, differenceInDays, differenceInWeeks,
2431
2239
  // ALIASES
2432
2240
  getDateAsInt as convertDateAsInt, getDateAsObject as convertDateAsObject,
2433
2241
  // LOGGER