@ptolemy2002/list-object-utils 1.2.3 → 1.2.4

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 +6 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -94,6 +94,9 @@ 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
100
  const result = {};
98
101
  a.forEach((element, i) => {
99
102
  if (b[i] !== element) {
@@ -116,6 +119,9 @@ function listDifference(a, b) {
116
119
  return result;
117
120
  }
118
121
  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;
119
125
  const result = {};
120
126
  for (const key in a) {
121
127
  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.3",
3
+ "version": "1.2.4",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js"