MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / deepCompare

Function deepCompare

lib/web/CodeMirror/test/sql-hint-test.js:286–300  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

284 })
285
286 function deepCompare(a, b) {
287 if (a === b) return true
288 if (!(a && typeof a == "object") ||
289 !(b && typeof b == "object")) return false
290 var array = Array.isArray(a)
291 if (Array.isArray(b) != array) return false
292 if (array) {
293 if (a.length != b.length) return false
294 for (var i = 0; i < a.length; i++) if (!deepCompare(a[i], b[i])) return false
295 } else {
296 for (var p in a) if (!(p in b) || !deepCompare(a[p], b[p])) return false
297 for (var p in b) if (!(p in a)) return false
298 }
299 return true
300 }
301})();

Callers 1

testFunction · 0.70

Calls

no outgoing calls

Tested by 1

testFunction · 0.56