@ptolemy2002/list-object-utils 1.2.4 → 1.2.5
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.js +4 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -94,9 +94,8 @@ function isSet(list) {
|
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
96
96
|
function listDifference(a, b) {
|
|
97
|
-
if (a === b) return
|
|
98
|
-
if (!a || !b) return
|
|
99
|
-
if (a.length !== b.length) return false;
|
|
97
|
+
if (a === b) return {};
|
|
98
|
+
if (!a || !b) return b;
|
|
100
99
|
const result = {};
|
|
101
100
|
a.forEach((element, i) => {
|
|
102
101
|
if (b[i] !== element) {
|
|
@@ -119,9 +118,8 @@ function listDifference(a, b) {
|
|
|
119
118
|
return result;
|
|
120
119
|
}
|
|
121
120
|
function objectDifference(a, b) {
|
|
122
|
-
if (a === b) return
|
|
123
|
-
if (!a || !b) return
|
|
124
|
-
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
121
|
+
if (a === b) return {};
|
|
122
|
+
if (!a || !b) return b;
|
|
125
123
|
const result = {};
|
|
126
124
|
for (const key in a) {
|
|
127
125
|
if (b[key] !== a[key]) {
|