Created
March 28, 2015 20:30
-
-
Save darthneel/bea5a6abac45c13c08ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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