@deepnoid/canvas 0.1.46 → 0.1.47

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.
@@ -40,26 +40,17 @@ export const isEqualWith = (a, b, areValuesEqual) => {
40
40
  };
41
41
  export const ignoreImageKey = (objValue, othValue) => {
42
42
  if (Array.isArray(objValue) && Array.isArray(othValue)) {
43
- if (objValue.length !== othValue.length) {
43
+ if (objValue.length !== othValue.length)
44
44
  return false;
45
- }
46
- for (let i = 0; i < objValue.length; i++) {
47
- if (!isEqualWith(objValue[i], othValue[i], ignoreImageKey)) {
48
- return false;
49
- }
50
- }
51
- return true;
45
+ return objValue.every((item, i) => isEqualWith(item, othValue[i], ignoreImageKey));
52
46
  }
53
- if (typeof objValue === 'object' && typeof othValue === 'object' && objValue !== null && othValue !== null) {
54
- const objKeys = Object.keys(objValue);
55
- const othKeys = Object.keys(othValue);
56
- if (objKeys.length !== othKeys.length) {
57
- return false;
58
- }
59
- for (let key of objKeys) {
60
- if (key === 'image') {
47
+ if (typeof objValue === 'object' && typeof othValue === 'object' && objValue && othValue) {
48
+ const objKeys = Object.keys(objValue).filter((key) => key !== 'image');
49
+ const othKeys = Object.keys(othValue).filter((key) => key !== 'image');
50
+ const allKeys = new Set([...objKeys, ...othKeys]);
51
+ for (const key of allKeys) {
52
+ if (key === 'image')
61
53
  continue;
62
- }
63
54
  if (!isEqualWith(objValue[key], othValue[key], ignoreImageKey)) {
64
55
  return false;
65
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/canvas",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.cjs",