{"ScriptPreparationCode":"function equal(a, b) {\r\n if (a === b) return true;\r\n\r\n if (a \u0026\u0026 b \u0026\u0026 typeof a == \u0027object\u0027 \u0026\u0026 typeof b == \u0027object\u0027) {\r\n if (a.constructor !== b.constructor) return false;\r\n\r\n var length, i, keys;\r\n if (Array.isArray(a)) {\r\n length = a.length;\r\n if (length != b.length) return false;\r\n for (i = length; i-- !== 0;)\r\n if (!equal(a[i], b[i])) return false;\r\n return true;\r\n }\r\n\r\n\r\n\r\n if (a.constructor === RegExp) return a.source === b.source \u0026\u0026 a.flags === b.flags;\r\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\r\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\r\n\r\n keys = Object.keys(a);\r\n length = keys.length;\r\n if (length !== Object.keys(b).length) return false;\r\n\r\n for (i = length; i-- !== 0;)\r\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\r\n\r\n for (i = length; i-- !== 0;) {\r\n var key = keys[i];\r\n\r\n if (!equal(a[key], b[key])) return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n // true if both NaN, false otherwise\r\n return a !== a \u0026\u0026 b !== b;\r\n};\r\n\r\nconst isUndefined = v =\u003E v === undefined\r\nconst table = new WeakMap();\r\nlet counter = 0;\r\nconst stableHash = (arg) =\u003E {\r\n const type = typeof arg;\r\n const constructor = arg \u0026\u0026 arg.constructor;\r\n const isDate = constructor == Date;\r\n let result;\r\n let index;\r\n if (Object(arg) === arg \u0026\u0026 !isDate \u0026\u0026 constructor != RegExp) {\r\n result = table.get(arg);\r\n if (result) return result;\r\n result = \u002B\u002Bcounter \u002B \u0027~\u0027;\r\n table.set(arg, result);\r\n if (constructor == Array) {\r\n result = \u0027@\u0027;\r\n for (index = 0; index \u003C arg.length; index\u002B\u002B) {\r\n result \u002B= stableHash(arg[index]) \u002B \u0027,\u0027;\r\n }\r\n table.set(arg, result);\r\n }\r\n if (constructor == Object) {\r\n result = \u0027#\u0027;\r\n const keys = Object.keys(arg).sort();\r\n while (!isUndefined(index = keys.pop())) {\r\n if (!isUndefined(arg[index])) {\r\n result \u002B= index \u002B \u0027:\u0027 \u002B stableHash(arg[index]) \u002B \u0027,\u0027;\r\n }\r\n }\r\n table.set(arg, result);\r\n }\r\n } else {\r\n result = isDate ? arg.toJSON() : type == \u0027symbol\u0027 ? arg.toString() : type == \u0027string\u0027 ? JSON.stringify(arg) : \u0027\u0027 \u002B arg;\r\n }\r\n return result;\r\n};\r\n\r\nfunction compare(currentData, newData) {\r\n return stableHash(currentData) == stableHash(newData)\r\n}\r\n\r\n// 1 level deep\r\nvar data = [{\r\n description: \u0027equal numbers\u0027,\r\n value1: 1,\r\n value2: 1,\r\n equal: true,\r\n },\r\n {\r\n description: \u0027not equal numbers\u0027,\r\n value1: 1,\r\n value2: 2,\r\n equal: false,\r\n },\r\n {\r\n description: \u0027number and array are not equal\u0027,\r\n value1: 1,\r\n value2: [],\r\n equal: false,\r\n },\r\n {\r\n description: \u00270 and null are not equal\u0027,\r\n value1: 0,\r\n value2: null,\r\n equal: false,\r\n },\r\n {\r\n description: \u0027equal strings\u0027,\r\n value1: \u0027a\u0027,\r\n value2: \u0027a\u0027,\r\n equal: true,\r\n },\r\n {\r\n description: \u0027big object\u0027,\r\n value1: {\r\n prop1: \u0027value1\u0027,\r\n prop2: \u0027value2\u0027,\r\n prop3: \u0027value3\u0027,\r\n prop4: {\r\n subProp1: \u0027sub value1\u0027,\r\n subProp2: {\r\n subSubProp1: \u0027sub sub value1\u0027,\r\n subSubProp2: [\r\n 1,\r\n 2,\r\n {\r\n prop2: 1,\r\n prop: 2\r\n },\r\n 4,\r\n 5,\r\n ],\r\n },\r\n },\r\n prop5: 1000,\r\n prop6: new Date(2016, 2, 10),\r\n },\r\n value2: {\r\n prop5: 1000,\r\n prop3: \u0027value3\u0027,\r\n prop1: \u0027value1\u0027,\r\n prop2: \u0027value2\u0027,\r\n prop6: new Date(\u00272016/03/10\u0027),\r\n prop4: {\r\n subProp2: {\r\n subSubProp1: \u0027sub sub value1\u0027,\r\n subSubProp2: [\r\n 1,\r\n 2,\r\n {\r\n prop2: 1,\r\n prop: 2\r\n },\r\n 4,\r\n 5,\r\n ],\r\n },\r\n subProp1: \u0027sub value1\u0027,\r\n },\r\n },\r\n equal: true,\r\n },\r\n];","TestCases":[{"Name":"lodash","Code":"data.forEach((item) =\u003E {\r\n _.isEqual(item.value1, item.value2);\r\n });","IsDeferred":false},{"Name":"fast-deep-equal","Code":"data.forEach((item) =\u003E {\r\n equal(item.value1, item.value2);\r\n });","IsDeferred":false},{"Name":"stable-hash-compare","Code":"data.forEach((item) =\u003E { compare(item.value1, item.value2) } )","IsDeferred":false}]}