Skip to content

Instantly share code, notes, and snippets.

@qzm
Last active April 23, 2017 13:51
Show Gist options
  • Save qzm/5112704fa975995a462a4ff1c232e489 to your computer and use it in GitHub Desktop.
Save qzm/5112704fa975995a462a4ff1c232e489 to your computer and use it in GitHub Desktop.
deep equal
var deepEqual = function (x, y) {
if ((typeof x == "object" && x != null) && (typeof y == "object" && y != null)) {
if (Object.keys(x).length != Object.keys(y).length) {
return false;
}
for (var prop in x) {
if (y.hasOwnProperty(prop)) {
return deepEqual(x[prop], y[prop]);
}
}
} else if (x !== y) {
return false;
} else {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment