@trackunit/shared-utils 1.13.49-alpha-3fb17ca5f15.0 → 1.13.49
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 +8 -8
- package/index.esm.js +8 -8
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -61,7 +61,7 @@ const truthy = (value) => {
|
|
|
61
61
|
* @template TObject - The type of the object.
|
|
62
62
|
*/
|
|
63
63
|
const objectEntries = (object) =>
|
|
64
|
-
// eslint-disable-next-line
|
|
64
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
65
65
|
Object.entries(object);
|
|
66
66
|
/**
|
|
67
67
|
* Converts an array of key-value pairs into an object.
|
|
@@ -71,7 +71,7 @@ Object.entries(object);
|
|
|
71
71
|
* @template TEntries - The type of the entries array.
|
|
72
72
|
*/
|
|
73
73
|
const objectFromEntries = (entries) => {
|
|
74
|
-
// eslint-disable-next-line
|
|
74
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
75
75
|
return Object.fromEntries(entries);
|
|
76
76
|
};
|
|
77
77
|
/**
|
|
@@ -88,7 +88,7 @@ const objectFromEntries = (entries) => {
|
|
|
88
88
|
* @returns {(keyof TObject)[]} An array of the keys of the object.
|
|
89
89
|
*/
|
|
90
90
|
const objectKeys = (object) => {
|
|
91
|
-
// eslint-disable-next-line
|
|
91
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
92
92
|
return Object.keys(object).map(key => key);
|
|
93
93
|
};
|
|
94
94
|
/**
|
|
@@ -103,7 +103,7 @@ const objectKeys = (object) => {
|
|
|
103
103
|
* @returns {Array} An array of the values of the object.
|
|
104
104
|
*/
|
|
105
105
|
const objectValues = (object) =>
|
|
106
|
-
// eslint-disable-next-line
|
|
106
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
107
107
|
Object.values(object);
|
|
108
108
|
|
|
109
109
|
/**
|
|
@@ -665,7 +665,7 @@ const fetchImageAsBase64 = async (url) => {
|
|
|
665
665
|
const deleteUndefinedKeys = (obj) => {
|
|
666
666
|
Object.keys(obj).forEach(key => {
|
|
667
667
|
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
668
|
-
// eslint-disable-next-line
|
|
668
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
669
669
|
deleteUndefinedKeys(obj[key]);
|
|
670
670
|
}
|
|
671
671
|
else if (obj[key] === undefined) {
|
|
@@ -689,7 +689,7 @@ const pick = (obj, ...keys) => {
|
|
|
689
689
|
acc[key] = obj[key];
|
|
690
690
|
return acc;
|
|
691
691
|
},
|
|
692
|
-
// eslint-disable-next-line
|
|
692
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
693
693
|
{});
|
|
694
694
|
};
|
|
695
695
|
/**
|
|
@@ -721,7 +721,7 @@ const getFirstLevelObjectPropertyDifferences = (obj1, obj2) => {
|
|
|
721
721
|
* @example replaceNullableNumbersWithZero({ a: 1, b: null, c: undefined }) // { a: 1, b: 0, c: 0 }
|
|
722
722
|
*/
|
|
723
723
|
const replaceNullableNumbersWithZero = (record) => {
|
|
724
|
-
// eslint-disable-next-line
|
|
724
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
725
725
|
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, value ?? 0]));
|
|
726
726
|
};
|
|
727
727
|
/**
|
|
@@ -735,7 +735,7 @@ const replaceNullableNumbersWithZero = (record) => {
|
|
|
735
735
|
const removeProperty = (obj, key) => {
|
|
736
736
|
const { [key]: _, ...rest } = obj;
|
|
737
737
|
// should be safe because we remove the key from the object, just no way to type it properly
|
|
738
|
-
// eslint-disable-next-line
|
|
738
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
739
739
|
return rest;
|
|
740
740
|
};
|
|
741
741
|
/**
|
package/index.esm.js
CHANGED
|
@@ -59,7 +59,7 @@ const truthy = (value) => {
|
|
|
59
59
|
* @template TObject - The type of the object.
|
|
60
60
|
*/
|
|
61
61
|
const objectEntries = (object) =>
|
|
62
|
-
// eslint-disable-next-line
|
|
62
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
63
63
|
Object.entries(object);
|
|
64
64
|
/**
|
|
65
65
|
* Converts an array of key-value pairs into an object.
|
|
@@ -69,7 +69,7 @@ Object.entries(object);
|
|
|
69
69
|
* @template TEntries - The type of the entries array.
|
|
70
70
|
*/
|
|
71
71
|
const objectFromEntries = (entries) => {
|
|
72
|
-
// eslint-disable-next-line
|
|
72
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
73
73
|
return Object.fromEntries(entries);
|
|
74
74
|
};
|
|
75
75
|
/**
|
|
@@ -86,7 +86,7 @@ const objectFromEntries = (entries) => {
|
|
|
86
86
|
* @returns {(keyof TObject)[]} An array of the keys of the object.
|
|
87
87
|
*/
|
|
88
88
|
const objectKeys = (object) => {
|
|
89
|
-
// eslint-disable-next-line
|
|
89
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
90
90
|
return Object.keys(object).map(key => key);
|
|
91
91
|
};
|
|
92
92
|
/**
|
|
@@ -101,7 +101,7 @@ const objectKeys = (object) => {
|
|
|
101
101
|
* @returns {Array} An array of the values of the object.
|
|
102
102
|
*/
|
|
103
103
|
const objectValues = (object) =>
|
|
104
|
-
// eslint-disable-next-line
|
|
104
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
105
105
|
Object.values(object);
|
|
106
106
|
|
|
107
107
|
/**
|
|
@@ -663,7 +663,7 @@ const fetchImageAsBase64 = async (url) => {
|
|
|
663
663
|
const deleteUndefinedKeys = (obj) => {
|
|
664
664
|
Object.keys(obj).forEach(key => {
|
|
665
665
|
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
666
|
-
// eslint-disable-next-line
|
|
666
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
667
667
|
deleteUndefinedKeys(obj[key]);
|
|
668
668
|
}
|
|
669
669
|
else if (obj[key] === undefined) {
|
|
@@ -687,7 +687,7 @@ const pick = (obj, ...keys) => {
|
|
|
687
687
|
acc[key] = obj[key];
|
|
688
688
|
return acc;
|
|
689
689
|
},
|
|
690
|
-
// eslint-disable-next-line
|
|
690
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
691
691
|
{});
|
|
692
692
|
};
|
|
693
693
|
/**
|
|
@@ -719,7 +719,7 @@ const getFirstLevelObjectPropertyDifferences = (obj1, obj2) => {
|
|
|
719
719
|
* @example replaceNullableNumbersWithZero({ a: 1, b: null, c: undefined }) // { a: 1, b: 0, c: 0 }
|
|
720
720
|
*/
|
|
721
721
|
const replaceNullableNumbersWithZero = (record) => {
|
|
722
|
-
// eslint-disable-next-line
|
|
722
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
723
723
|
return Object.fromEntries(Object.entries(record).map(([key, value]) => [key, value ?? 0]));
|
|
724
724
|
};
|
|
725
725
|
/**
|
|
@@ -733,7 +733,7 @@ const replaceNullableNumbersWithZero = (record) => {
|
|
|
733
733
|
const removeProperty = (obj, key) => {
|
|
734
734
|
const { [key]: _, ...rest } = obj;
|
|
735
735
|
// should be safe because we remove the key from the object, just no way to type it properly
|
|
736
|
-
// eslint-disable-next-line
|
|
736
|
+
// eslint-disable-next-line @trackunit/no-typescript-assertion
|
|
737
737
|
return rest;
|
|
738
738
|
};
|
|
739
739
|
/**
|