{"ScriptPreparationCode":"function optimizedDeepEqual(foo, bar) {\r\n // First level of comparison (compare properties a, b, and c directly)\r\n if (foo.a !== bar.a || foo.b !== bar.b) return false;\r\n\r\n // Now compare the second level (foo.c and bar.c exist and are objects)\r\n const fooC = foo.c, barC = bar.c;\r\n if (typeof fooC !== \u0027object\u0027 || typeof barC !== \u0027object\u0027) return false;\r\n if (fooC.a !== barC.a || fooC.b !== barC.b) return false;\r\n\r\n // Compare the third level (foo.c.c and bar.c.c exist and are objects)\r\n const fooCC = fooC.c, barCC = barC.c;\r\n if (typeof fooCC !== \u0027object\u0027 || typeof barCC !== \u0027object\u0027) return false;\r\n if (fooCC.a !== barCC.a || fooCC.b !== barCC.b) return false;\r\n\r\n // We are now 3 levels deep, so if we got here without returning false, return true\r\n return true;\r\n}\r\nwindow.optimizedDeepEqual = optimizedDeepEqual;\r\n\r\n// 1 level deep\r\nwindow.foo1 = {\r\n a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } },\r\n d: 3, e: 4, f: 5, g: 6, h: 7, i: 8, j: 9,\r\n k: { a: 10, b: 11 }, l: { a: 12, b: 13 }, m: { a: 14, b: 15 }\r\n};\r\n\r\nwindow.bar1 = {\r\n a: 1, b: 3, c: { a: 1, b: 2, c: { a: 1, b: 2 } }, // \u003C-- 1 level deep difference (b: 3 vs b: 2)\r\n d: 3, e: 4, f: 5, g: 6, h: 7, i: 8, j: 9,\r\n k: { a: 10, b: 11 }, l: { a: 12, b: 13 }, m: { a: 14, b: 15 }\r\n};\r\n\r\n// 2 levels deep\r\nwindow.foo2 = {\r\n a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2, d: 3, e: 4 } },\r\n d: { a: 5, b: 6, c: { a: 7, b: 8, c: 9 } },\r\n e: { a: 10, b: 11, c: { a: 12, b: 13, c: 14 } },\r\n f: { a: 15, b: 16, c: { a: 17, b: 18, c: 19 } }\r\n};\r\n\r\nwindow.bar2 = {\r\n a: 1, b: 2, c: { a: 1, b: 3, c: { a: 1, b: 2, d: 3, e: 4 } }, // \u003C-- 2 levels deep difference (b: 3 vs b: 2)\r\n d: { a: 5, b: 6, c: { a: 7, b: 8, c: 9 } },\r\n e: { a: 10, b: 11, c: { a: 12, b: 13, c: 14 } },\r\n f: { a: 15, b: 16, c: { a: 17, b: 18, c: 19 } }\r\n};\r\n\r\n// 3 levels deep\r\nwindow.foo3 = {\r\n a: 1, b: 2, c: {\r\n a: 1, b: 2, c: {\r\n a: 1, b: 2, c: { a: 3, b: 4, c: 5 },\r\n d: { a: 6, b: 7, c: 8, d: 9 },\r\n e: { a: 10, b: 11, c: 12, d: 13 }\r\n }\r\n },\r\n d: { a: 14, b: 15, c: { a: 16, b: 17, c: 18 } },\r\n e: { a: 19, b: 20, c: { a: 21, b: 22, c: 23 } }\r\n};\r\n\r\nwindow.bar3 = {\r\n a: 1, b: 2, c: {\r\n a: 1, b: 2, c: {\r\n a: 1, b: 2, c: { a: 3, b: 4, c: 5 },\r\n d: { a: 6, b: 7, c: 8, d: 9 },\r\n e: { a: 10, b: 11, c: 12, d: 13 }\r\n }\r\n },\r\n d: { a: 14, b: 15, c: { a: 16, b: 17, c: 24 } }, // \u003C-- 3 levels deep difference (c: 24 vs c: 23)\r\n e: { a: 19, b: 20, c: { a: 21, b: 22, c: 23 } }\r\n};","TestCases":[{"Name":"_.isEqual Level 1","Code":"_.isEqual(window.foo1, window.bar1)","IsDeferred":false},{"Name":"JSON.stringify Level 1","Code":"JSON.stringify(window.foo1) === JSON.stringify(window.bar1);","IsDeferred":false},{"Name":"_.isEqual Level 2","Code":"_.isEqual(window.foo2, window.bar2)","IsDeferred":false},{"Name":"JSON.stringify Level 2","Code":"JSON.stringify(window.foo2) === JSON.stringify(window.bar2);","IsDeferred":false},{"Name":"_.isEqual Level 3","Code":"_.isEqual(window.foo3, window.bar3)","IsDeferred":false},{"Name":"JSON.stringify Level 3","Code":"JSON.stringify(window.foo3) === JSON.stringify(window.bar3);","IsDeferred":false},{"Name":"optimizedDeepEqual level 1","Code":"window.optimizedDeepEqual(window.foo1, window.bar1);","IsDeferred":false},{"Name":"optimizedDeepEqual level 2","Code":"window.optimizedDeepEqual(window.foo2, window.bar2);","IsDeferred":false},{"Name":"optimizedDeepEqual level 3","Code":"window.optimizedDeepEqual(window.foo3, window.bar3);","IsDeferred":false}]}