@ptolemy2002/list-object-utils 1.2.2 → 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 (3) hide show
  1. package/README.md +1 -2
  2. package/index.js +6 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -148,8 +148,7 @@ A simple implementation of `JSON.stringify` that converts undefined values to `n
148
148
  `String` - The string representation of the object.
149
149
 
150
150
  ## Meta
151
- This is a React Library Created by Ptolemy2002's [cra-template-react-library](https://www.npmjs.com/package/@ptolemy2002/cra-template-react-library) template in combination with [create-react-app](https://www.npmjs.com/package/create-react-app). It contains methods of building and publishing your library to npm.
152
- For now, the library makes use of React 18 and does not use TypeScript.
151
+ This is a React Library Created by Ptolemy2002's [cra-template-react-library](https://www.npmjs.com/package/@ptolemy2002/cra-template-react-library) template in combination with [create-react-app](https://www.npmjs.com/package/create-react-app). However, it does not actually depend on React - it has been modified to work out of the box. It contains methods of building and publishing your library to npm.
153
152
 
154
153
  ## Peer Dependencies
155
154
  This project does not have any peer dependencies, so it should work out of the box.
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.2",
3
+ "version": "1.2.4",
4
4
  "main": "index.js",
5
5
  "files": [
6
6
  "index.js"