@ptolemy2002/list-object-utils 1.2.3 → 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 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -94,6 +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 b;
|
|
97
99
|
const result = {};
|
|
98
100
|
a.forEach((element, i) => {
|
|
99
101
|
if (b[i] !== element) {
|
|
@@ -116,6 +118,8 @@ function listDifference(a, b) {
|
|
|
116
118
|
return result;
|
|
117
119
|
}
|
|
118
120
|
function objectDifference(a, b) {
|
|
121
|
+
if (a === b) return {};
|
|
122
|
+
if (!a || !b) return b;
|
|
119
123
|
const result = {};
|
|
120
124
|
for (const key in a) {
|
|
121
125
|
if (b[key] !== a[key]) {
|