@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.
Files changed (2) hide show
  1. package/index.js +4 -6
  2. 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 true;
98
- if (!a || !b) return false;
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 true;
123
- if (!a || !b) return false;
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]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/list-object-utils",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js"