topkat-utils 1.0.42 → 1.0.45

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "topkat-utils",
3
- "version": "1.0.42",
4
- "type": "module",
3
+ "version": "1.0.45",
4
+ "type": "commonjs",
5
5
  "private": false,
6
6
  "description": "UTILS BIG TIME",
7
7
  "author": "538ROMEO",
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "module": "es2020",
3
+ "module": "CommonJS",
4
4
  "allowSyntheticDefaultImports": true,
5
5
  "target": "ES2018",
6
6
  "noImplicitAny": false,
package/utils.d.ts CHANGED
@@ -8,7 +8,7 @@ declare type Color = [number, number, number];
8
8
  declare type ObjectGeneric = {
9
9
  [k: string]: any;
10
10
  };
11
- declare type BaseTypes = 'objectId' | 'dateInt6' | 'dateInt' | 'dateInt8' | 'dateInt12' | 'time' | 'humanReadableTimestamp' | 'date' | 'dateObject' | 'array' | 'object' | 'buffer' | 'string' | 'function' | 'boolean' | 'number' | 'bigint' | 'year' | 'email';
11
+ declare type BaseTypes = 'objectId' | 'dateInt6' | 'dateInt' | 'dateInt8' | 'dateInt12' | 'time' | 'humanReadableTimestamp' | 'date' | 'dateObject' | 'array' | 'object' | 'buffer' | 'string' | 'function' | 'boolean' | 'number' | 'bigint' | 'year' | 'email' | 'any';
12
12
  /** Round with custom number of decimals (default:0) */
13
13
  declare function round(number: number, decimals?: number): number;
14
14
  /** Round with custom number of decimals (default:0) */
@@ -311,7 +311,7 @@ declare function getId(obj?: any): string;
311
311
  /**
312
312
  * @returns {array} return values of all callbacks
313
313
  */
314
- declare function forI(nbIterations: number, callback: (number: any) => void | any): any[];
314
+ declare function forI(nbIterations: number, callback: (number: number, previousValue: any, arrayOfPreviousValues: any[]) => void | any): any[];
315
315
  declare function forIasync(nbIterations: number, callback: (number: any) => void | any): Promise<any[]>;
316
316
  declare function cleanStackTrace(stack: any): string;
317
317
  declare function isset(...elms: any[]): boolean;
@@ -437,6 +437,7 @@ declare type ValidatorObject = {
437
437
  regexp?: RegExp;
438
438
  mustNotBeSet?: boolean;
439
439
  optional?: boolean;
440
+ isArray?: boolean;
440
441
  [k: string]: any;
441
442
  };
442
443
  declare function validator(...paramsToValidate: ValidatorObject[]): void;
@@ -507,32 +508,34 @@ declare function getDuration(startDate: any, endDate: any, inMinutes?: boolean):
507
508
  * @param {Boolean} strict$ if true,
508
509
  */
509
510
  declare function doDateOverlap(event1: any, event2: any, fieldNameForStartDate$?: string, fieldNameForEndDate$?: string, allowNull$?: boolean, strict$?: boolean): boolean;
510
- declare function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp', sameDayAllowed?: boolean): number;
511
- declare function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: 'date', sameDayAllowed?: boolean): Date;
511
+ declare type DateStringFormats = 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp';
512
+ declare type DateObjectFormat = 'date';
513
+ declare function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: DateStringFormats, sameDayAllowed?: boolean): number;
514
+ declare function nextWeekDay(fromDate: any, weekDayInt?: 0 | 1 | 2 | 3 | 4 | 5 | 6, outputFormat?: DateObjectFormat, sameDayAllowed?: boolean): Date;
512
515
  /**
513
516
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
514
517
  */
515
- declare function addDays(dateAllFormat: Date | string | number, numberOfDays: number, outputFormat: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string;
516
- declare function addDays(dateAllFormat: Date | string | number, numberOfDays: number, outputFormat: 'date'): Date;
518
+ declare function addDays(dateAllFormat?: Date | string | number, numberOfDays?: number, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string;
519
+ declare function addDays(dateAllFormat?: Date | string | number, numberOfDays?: number, outputFormat?: 'date'): Date;
517
520
  /**
518
521
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
519
522
  */
520
- declare function addMinutes(dateAllFormat: Date | string | number, numberOfMinutes: number, outputFormat: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string;
521
- declare function addMinutes(dateAllFormat: Date | string | number, numberOfMinutes: number, outputFormat: 'date'): Date;
523
+ declare function addMinutes(dateAllFormat?: Date | string | number, numberOfMinutes?: number, outputFormat?: DateStringFormats): string;
524
+ declare function addMinutes(dateAllFormat?: Date | string | number, numberOfMinutes?: number, outputFormat?: DateObjectFormat): Date;
522
525
  /**
523
526
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
524
527
  */
525
- declare function addHours(dateAllFormat: Date | string | number, numberOfHours: number, outputFormat: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string;
526
- declare function addHours(dateAllFormat: Date | string | number, numberOfHours: number, outputFormat: 'date'): Date;
528
+ declare function addHours(dateAllFormat?: Date | string | number, numberOfHours?: number, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string;
529
+ declare function addHours(dateAllFormat?: Date | string | number, numberOfHours?: number, outputFormat?: 'date'): Date;
527
530
  /**
528
531
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
529
532
  */
530
- declare function addMonths(dateAllFormat: Date | string | number, numberOfMonths: number, outputFormat: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string;
531
- declare function addMonths(dateAllFormat: Date | string | number, numberOfMonths: number, outputFormat: 'date'): Date;
533
+ declare function addMonths(dateAllFormat?: Date | string | number, numberOfMonths?: number, outputFormat?: 'dateInt8' | 'dateInt12' | 'humanReadableTimestamp'): string;
534
+ declare function addMonths(dateAllFormat?: Date | string | number, numberOfMonths?: number, outputFormat?: 'date'): Date;
532
535
  /**
533
536
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
534
537
  */
535
- declare function addYears(dateAllFormat?: Date | string | number, numberOfYears?: number, outputFormat?: DateFormats): string | number | Date;
538
+ declare function addYears(dateAllFormat?: Date | string | number, numberOfYears?: number, outputFormat?: DateFormats): Date;
536
539
  declare function getDayOfMonth(dateAllFormat?: Date | string | number): any;
537
540
  declare function getYear(dateAllFormat?: Date | string | number): any;
538
541
  declare function getHours(dateAllFormat?: Date | string | number): any;
@@ -540,11 +543,11 @@ declare function getMinutes(dateAllFormat?: Date | string | number): any;
540
543
  /**
541
544
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
542
545
  */
543
- declare function lastDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: DateFormats): string | number | Date;
546
+ declare function lastDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: DateFormats): Date;
544
547
  /**
545
548
  * @param {String} outputFormat dateInt, dateInt8, dateInt12, date, humanReadableTimestamp, int (dateInt8)
546
549
  */
547
- declare function firstDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: DateFormats): string | number | Date;
550
+ declare function firstDayOfMonth(dateAllFormat?: Date | string | number, outputFormat?: DateFormats): Date;
548
551
  declare function differenceInMilliseconds(startDateAllFormat: any, endDateAllFormat: any): number;
549
552
  declare function differenceInSeconds(startDateAllFormat: any, endDateAllFormat: any): number;
550
553
  declare function differenceInMinutes(startDateAllFormat: any, endDateAllFormat: any): number;