@trackunit/shared-utils 0.0.56 → 0.0.58
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/index.cjs.js +37 -14
- package/index.esm.d.ts +1 -0
- package/index.esm.js +36 -14
- package/package.json +1 -1
- package/src/DateTimeFormat.d.ts +37 -18
- package/src/arrayUtils.d.ts +2 -2
- package/src/objectUtils.d.ts +1 -1
package/index.cjs.js
CHANGED
|
@@ -10,19 +10,36 @@ exports.HoursAndMinutesFormat = void 0;
|
|
|
10
10
|
HoursAndMinutesFormat["HOURS_MIN"] = "HOURS_MIN";
|
|
11
11
|
HoursAndMinutesFormat["HOURS_LONG"] = "HOURS_LONG";
|
|
12
12
|
})(exports.HoursAndMinutesFormat || (exports.HoursAndMinutesFormat = {}));
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
13
|
+
const DateTimeFormat = {
|
|
14
|
+
DATE: {
|
|
15
|
+
selectFormat: "dateOnly",
|
|
16
|
+
dateFormat: "short",
|
|
17
|
+
},
|
|
18
|
+
DATE_LONG: {
|
|
19
|
+
selectFormat: "dateOnly",
|
|
20
|
+
dateFormat: "long",
|
|
21
|
+
},
|
|
22
|
+
DATE_LONG_TIME: {
|
|
23
|
+
dateFormat: "long",
|
|
24
|
+
timeFormat: "short",
|
|
25
|
+
},
|
|
26
|
+
DATE_SHORT: {
|
|
27
|
+
selectFormat: "dateOnly",
|
|
28
|
+
dateFormat: "medium",
|
|
29
|
+
},
|
|
30
|
+
DATE_SHORT_TIME: {
|
|
31
|
+
dateFormat: "medium",
|
|
32
|
+
timeFormat: "short",
|
|
33
|
+
},
|
|
34
|
+
TIME_SHORT: {
|
|
35
|
+
selectFormat: "timeOnly",
|
|
36
|
+
timeFormat: "short",
|
|
37
|
+
},
|
|
38
|
+
TIME_LONG: {
|
|
39
|
+
selectFormat: "timeOnly",
|
|
40
|
+
timeFormat: "medium",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
26
43
|
|
|
27
44
|
/**
|
|
28
45
|
* @description Converts a date to a string in ISO format.
|
|
@@ -697,7 +714,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
697
714
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
698
715
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
699
716
|
});
|
|
700
|
-
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
720
|
+
var e = new Error(message);
|
|
721
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
722
|
+
};
|
|
701
723
|
|
|
702
724
|
const dataURItoBlob = (dataURI) => {
|
|
703
725
|
var _a, _b, _c, _d, _e;
|
|
@@ -1059,6 +1081,7 @@ const isSorted = (sortInput) => {
|
|
|
1059
1081
|
return originalKeys.every((key, index) => key === sortedKeys[index]);
|
|
1060
1082
|
};
|
|
1061
1083
|
|
|
1084
|
+
exports.DateTimeFormat = DateTimeFormat;
|
|
1062
1085
|
exports.align = align;
|
|
1063
1086
|
exports.alphabeticallySort = alphabeticallySort;
|
|
1064
1087
|
exports.arrayLengthCompare = arrayLengthCompare;
|
package/index.esm.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/index.esm.js
CHANGED
|
@@ -6,19 +6,36 @@ var HoursAndMinutesFormat;
|
|
|
6
6
|
HoursAndMinutesFormat["HOURS_MIN"] = "HOURS_MIN";
|
|
7
7
|
HoursAndMinutesFormat["HOURS_LONG"] = "HOURS_LONG";
|
|
8
8
|
})(HoursAndMinutesFormat || (HoursAndMinutesFormat = {}));
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
9
|
+
const DateTimeFormat = {
|
|
10
|
+
DATE: {
|
|
11
|
+
selectFormat: "dateOnly",
|
|
12
|
+
dateFormat: "short",
|
|
13
|
+
},
|
|
14
|
+
DATE_LONG: {
|
|
15
|
+
selectFormat: "dateOnly",
|
|
16
|
+
dateFormat: "long",
|
|
17
|
+
},
|
|
18
|
+
DATE_LONG_TIME: {
|
|
19
|
+
dateFormat: "long",
|
|
20
|
+
timeFormat: "short",
|
|
21
|
+
},
|
|
22
|
+
DATE_SHORT: {
|
|
23
|
+
selectFormat: "dateOnly",
|
|
24
|
+
dateFormat: "medium",
|
|
25
|
+
},
|
|
26
|
+
DATE_SHORT_TIME: {
|
|
27
|
+
dateFormat: "medium",
|
|
28
|
+
timeFormat: "short",
|
|
29
|
+
},
|
|
30
|
+
TIME_SHORT: {
|
|
31
|
+
selectFormat: "timeOnly",
|
|
32
|
+
timeFormat: "short",
|
|
33
|
+
},
|
|
34
|
+
TIME_LONG: {
|
|
35
|
+
selectFormat: "timeOnly",
|
|
36
|
+
timeFormat: "medium",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
22
39
|
|
|
23
40
|
/**
|
|
24
41
|
* @description Converts a date to a string in ISO format.
|
|
@@ -693,7 +710,12 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
693
710
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
694
711
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
695
712
|
});
|
|
696
|
-
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
716
|
+
var e = new Error(message);
|
|
717
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
718
|
+
};
|
|
697
719
|
|
|
698
720
|
const dataURItoBlob = (dataURI) => {
|
|
699
721
|
var _a, _b, _c, _d, _e;
|
package/package.json
CHANGED
package/src/DateTimeFormat.d.ts
CHANGED
|
@@ -1,21 +1,40 @@
|
|
|
1
1
|
export declare enum HoursAndMinutesFormat {
|
|
2
|
-
HOURS_MIN_SEC_LONG = "HOURS_MIN_SEC_LONG"
|
|
3
|
-
HOURS_MIN_SEC = "HOURS_MIN_SEC"
|
|
4
|
-
HOURS_MIN_LONG = "HOURS_MIN_LONG"
|
|
5
|
-
HOURS_MIN = "HOURS_MIN"
|
|
2
|
+
HOURS_MIN_SEC_LONG = "HOURS_MIN_SEC_LONG",// h [h] mm [min] ss [sec]
|
|
3
|
+
HOURS_MIN_SEC = "HOURS_MIN_SEC",// h[h] m[m] s[s]
|
|
4
|
+
HOURS_MIN_LONG = "HOURS_MIN_LONG",// h [hrs] mm [min]
|
|
5
|
+
HOURS_MIN = "HOURS_MIN",// h[h] m[m]
|
|
6
6
|
HOURS_LONG = "HOURS_LONG"
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
8
|
+
export declare const DateTimeFormat: {
|
|
9
|
+
readonly DATE: {
|
|
10
|
+
readonly selectFormat: "dateOnly";
|
|
11
|
+
readonly dateFormat: "short";
|
|
12
|
+
};
|
|
13
|
+
readonly DATE_LONG: {
|
|
14
|
+
readonly selectFormat: "dateOnly";
|
|
15
|
+
readonly dateFormat: "long";
|
|
16
|
+
};
|
|
17
|
+
readonly DATE_LONG_TIME: {
|
|
18
|
+
readonly dateFormat: "long";
|
|
19
|
+
readonly timeFormat: "short";
|
|
20
|
+
};
|
|
21
|
+
readonly DATE_SHORT: {
|
|
22
|
+
readonly selectFormat: "dateOnly";
|
|
23
|
+
readonly dateFormat: "medium";
|
|
24
|
+
};
|
|
25
|
+
readonly DATE_SHORT_TIME: {
|
|
26
|
+
readonly dateFormat: "medium";
|
|
27
|
+
readonly timeFormat: "short";
|
|
28
|
+
};
|
|
29
|
+
readonly TIME_SHORT: {
|
|
30
|
+
readonly selectFormat: "timeOnly";
|
|
31
|
+
readonly timeFormat: "short";
|
|
32
|
+
};
|
|
33
|
+
readonly TIME_LONG: {
|
|
34
|
+
readonly selectFormat: "timeOnly";
|
|
35
|
+
readonly timeFormat: "medium";
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
type DateTimeFormatKey = keyof typeof DateTimeFormat;
|
|
39
|
+
export type DateTimeFormatType = (typeof DateTimeFormat)[DateTimeFormatKey];
|
|
40
|
+
export {};
|
package/src/arrayUtils.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare function ensureArray<T>(arrayish: T | T[]): T[];
|
|
|
10
10
|
* @param newArray The new array of items to merge with the previous array
|
|
11
11
|
* @returns A new array with the items from the previous array and the new array, but only if the item's key is unique.
|
|
12
12
|
*/
|
|
13
|
-
export declare const unionArraysByKey: <T extends object>(key: keyof T, previous: T[] |
|
|
13
|
+
export declare const unionArraysByKey: <T extends object>(key: keyof T, previous: T[] | undefined | null, newArray: T[] | undefined | null) => T[];
|
|
14
14
|
/** Ensures if an array is equal to another array */
|
|
15
15
|
export declare const isStringArrayEqual: (first?: string[], second?: string[]) => boolean;
|
|
16
16
|
/**
|
|
@@ -19,4 +19,4 @@ export declare const isStringArrayEqual: (first?: string[], second?: string[]) =
|
|
|
19
19
|
* @param array - The array to check.
|
|
20
20
|
* @returns The array if not empty, otherwise undefined.
|
|
21
21
|
*/
|
|
22
|
-
export declare const arrayNotEmpty: <T>(array?: T[]
|
|
22
|
+
export declare const arrayNotEmpty: <T>(array?: T[]) => T[] | undefined;
|
package/src/objectUtils.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const deleteUndefinedKeys: <T extends Record<string, unknown>>(ob
|
|
|
12
12
|
* @param obj - The object to check.
|
|
13
13
|
* @returns The object if not empty, otherwise undefined.
|
|
14
14
|
*/
|
|
15
|
-
export declare const objNotEmpty: <T extends object>(obj?: T
|
|
15
|
+
export declare const objNotEmpty: <T extends object>(obj?: T) => T | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Picks the given keys from an object, typesafe.
|
|
18
18
|
*/
|