Skip to content

Instantly share code, notes, and snippets.

@darthneel
Created March 28, 2015 20:30
Show Gist options
  • Save darthneel/bea5a6abac45c13c08ac to your computer and use it in GitHub Desktop.
Save darthneel/bea5a6abac45c13c08ac to your computer and use it in GitHub Desktop.
function objectsAreEqual(objectA, objectB) {
if (objectA === objectB) {
return true;
}
var objectAKeys = Object.keys(objectA);
var objectBKeys = Object.keys(objectB);
if (objectAKeys.length != objectBKeys.length) {
return false;
}
for (var i = 0; i < objectAKeys.length; i++) {
var prop = objectAKeys[i];
if (objectA[prop] !== objectB[prop]) {
return false;
}
};
return true;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment