Skip to content

Instantly share code, notes, and snippets.

@amodig
Created March 29, 2016 12:43
Show Gist options
  • Save amodig/2bbc5a1dbd021b3a2aba to your computer and use it in GitHub Desktop.
Save amodig/2bbc5a1dbd021b3a2aba to your computer and use it in GitHub Desktop.
JS deep equal
function deepEqual(o1, o2) {
if (typeof(o1)=="object" && typeof(o2)=="object" && o1 != null && o2 != null) {
for (var prop in o1) {
if (o1[prop] && o2[prop]) {
if (!deepEqual(o1[prop], o2[prop])) {
return false;
}
}
}
return true;
}
else if (o1===o2)
return true;
else
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment