@hashrytech/quick-components-kit 0.19.3 → 0.19.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @hashrytech/quick-components-kit
2
2
 
3
+ ## 0.19.4
4
+
5
+ ### Patch Changes
6
+
7
+ - patch: Adding compare-objects function
8
+
3
9
  ## 0.19.3
4
10
 
5
11
  ### Patch Changes
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @description This function takes two objects and compares them recursively. It returns true if both objects are the same.
3
+ * @param {any} object1
4
+ * @param {any} object2
5
+ * @returns {boolean}
6
+ */
7
+ export declare function compareObjectsDeep(object1: any, object2: any): boolean;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @description This function takes two objects and compares them recursively. It returns true if both objects are the same.
3
+ * @param {any} object1
4
+ * @param {any} object2
5
+ * @returns {boolean}
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ export function compareObjectsDeep(object1, object2) {
9
+ const objectKeys = Object.keys;
10
+ const object1Type = typeof object1;
11
+ const object2Type = typeof object2;
12
+ return object1 && object2 && object1Type === 'object' && object1Type === object2Type ? (objectKeys(object1).length === objectKeys(object2).length &&
13
+ objectKeys(object1).every(key => compareObjectsDeep(object1[key], object2[key]))) : (object1 === object2);
14
+ }
package/dist/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export * from './modules/api-proxy.js';
22
22
  export * from './modules/crypto.js';
23
23
  export * from './modules/problem-details.js';
24
24
  export * from './functions/object-to-form-data.js';
25
+ export * from './functions/compare-objects.js';
25
26
  export * from './ui/headers/header-1/index.js';
26
27
  export * from './ui/footers/footer-1/index.js';
27
28
  export * from './ui/banners/banner-1/index.js';
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ export * from './modules/api-proxy.js';
24
24
  export * from './modules/crypto.js';
25
25
  export * from './modules/problem-details.js';
26
26
  export * from './functions/object-to-form-data.js';
27
+ export * from './functions/compare-objects.js';
27
28
  export * from './ui/headers/header-1/index.js';
28
29
  export * from './ui/footers/footer-1/index.js';
29
30
  export * from './ui/banners/banner-1/index.js';
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/hashrytech/quick-components-kit.git"
7
7
  },
8
- "version": "0.19.3",
8
+ "version": "0.19.4",
9
9
  "license": "MIT",
10
10
  "author": "Hashry Tech",
11
11
  "files": [