@domql/utils
Advanced tools
Comparing version 2.5.113 to 2.5.114
@@ -471,25 +471,31 @@ "use strict"; | ||
const deepContains = (obj1, obj2) => { | ||
if (typeof obj1 !== typeof obj2) { | ||
return false; | ||
} | ||
if ((0, import_types.isObjectLike)(obj1)) { | ||
if (Array.isArray(obj1) && Array.isArray(obj2)) { | ||
if (obj1.length !== obj2.length) { | ||
return false; | ||
} | ||
for (let i = 0; i < obj1.length; i++) { | ||
if (!deepContains(obj1[i], obj2[i])) { | ||
const stack = [{ obj1, obj2 }]; | ||
while (stack.length) { | ||
const { obj1: obj12, obj2: obj22 } = stack.pop(); | ||
if (typeof obj12 !== typeof obj22) { | ||
return false; | ||
} | ||
if ((0, import_types.isObjectLike)(obj12)) { | ||
if (Array.isArray(obj12) && Array.isArray(obj22)) { | ||
if (obj12.length !== obj22.length) { | ||
return false; | ||
} | ||
} | ||
} else if ((0, import_types.isObjectLike)(obj1) && obj2 !== null) { | ||
for (const key in obj1) { | ||
const hasOwnProperty2 = Object.prototype.hasOwnProperty.call(obj2, key); | ||
if (!hasOwnProperty2 || !deepContains(obj1[key], obj2[key])) { | ||
return false; | ||
for (let i = 0; i < obj12.length; i++) { | ||
stack.push({ obj1: obj12[i], obj2: obj22[i] }); | ||
} | ||
} else if ((0, import_types.isObjectLike)(obj12) && obj22 !== null) { | ||
for (const key in obj12) { | ||
if (Object.prototype.hasOwnProperty.call(obj12, key)) { | ||
if (!Object.prototype.hasOwnProperty.call(obj22, key)) { | ||
return false; | ||
} | ||
stack.push({ obj1: obj12[key], obj2: obj22[key] }); | ||
} | ||
} | ||
} | ||
} else { | ||
if (obj12 !== obj22) { | ||
return false; | ||
} | ||
} | ||
} else { | ||
return obj2 === obj1; | ||
} | ||
@@ -496,0 +502,0 @@ return true; |
@@ -542,26 +542,34 @@ 'use strict' | ||
export const deepContains = (obj1, obj2) => { | ||
if (typeof obj1 !== typeof obj2) { | ||
return false | ||
} | ||
const stack = [{ obj1, obj2 }] | ||
if (isObjectLike(obj1)) { | ||
if (Array.isArray(obj1) && Array.isArray(obj2)) { | ||
if (obj1.length !== obj2.length) { | ||
return false | ||
} | ||
for (let i = 0; i < obj1.length; i++) { | ||
if (!deepContains(obj1[i], obj2[i])) { | ||
while (stack.length) { | ||
const { obj1, obj2 } = stack.pop() | ||
if (typeof obj1 !== typeof obj2) { | ||
return false | ||
} | ||
if (isObjectLike(obj1)) { | ||
if (Array.isArray(obj1) && Array.isArray(obj2)) { | ||
if (obj1.length !== obj2.length) { | ||
return false | ||
} | ||
} | ||
} else if (isObjectLike(obj1) && obj2 !== null) { | ||
for (const key in obj1) { | ||
const hasOwnProperty = Object.prototype.hasOwnProperty.call(obj2, key) | ||
if (!hasOwnProperty || !deepContains(obj1[key], obj2[key])) { | ||
return false | ||
for (let i = 0; i < obj1.length; i++) { | ||
stack.push({ obj1: obj1[i], obj2: obj2[i] }) | ||
} | ||
} else if (isObjectLike(obj1) && obj2 !== null) { | ||
for (const key in obj1) { | ||
if (Object.prototype.hasOwnProperty.call(obj1, key)) { | ||
if (!Object.prototype.hasOwnProperty.call(obj2, key)) { | ||
return false | ||
} | ||
stack.push({ obj1: obj1[key], obj2: obj2[key] }) | ||
} | ||
} | ||
} | ||
} else { | ||
if (obj1 !== obj2) { | ||
return false | ||
} | ||
} | ||
} else { | ||
return obj2 === obj1 | ||
} | ||
@@ -568,0 +576,0 @@ |
{ | ||
"name": "@domql/utils", | ||
"version": "2.5.113", | ||
"version": "2.5.114", | ||
"license": "MIT", | ||
@@ -26,3 +26,3 @@ "type": "module", | ||
}, | ||
"gitHead": "8436abbfa2752c4659982516ff9ad1db80862e42", | ||
"gitHead": "61b7ecee05aaf0d6682e5f3cdb11f0091e880f3d", | ||
"devDependencies": { | ||
@@ -29,0 +29,0 @@ "@babel/core": "^7.12.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85381
2608