This commit is contained in:
dzannotti 2015-08-08 01:04:04 +01:00
parent 37a8fc190f
commit 1ec3c01d5d

View File

@ -1,11 +1,11 @@
const deepEqual = function (x, y) { function deepEqual(x, y) {
if ((typeof x == "object" && x != null) && (typeof y == "object" && y != null)) { if ((typeof x === 'object' && x !== null) && (typeof y === 'object' && y !== null)) {
if (Object.keys(x).length != Object.keys(y).length) { if (Object.keys(x).length !== Object.keys(y).length) {
return false; return false;
} }
for (var prop in x) { for (let prop in x) {
if (y.hasOwnProperty(prop)) { if (y.hasOwnProperty(prop)) {
if (! deepEqual(x[prop], y[prop])) { if (!deepEqual(x[prop], y[prop])) {
return false; return false;
} }
} else { } else {
@ -13,7 +13,7 @@ const deepEqual = function (x, y) {
} }
} }
return true; return true;
} else if (x !== y){ } else if (x !== y) {
return false; return false;
} }
return true; return true;