Created
November 22, 2016 03:49
-
-
Save dustinpoissant/faf975f6a7b9cb915398931cb302fda4 to your computer and use it in GitHub Desktop.
A quick and dirty check to see of one object contains another.
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 containsObject(a,b){for(var c in a)if(!b[c]||a[c]!=b[c])return!1;return!0} |
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 containsObject(test, object){ | |
for(var k in test){ | |
if( | |
!object[k] || | |
test[k] != object[k] | |
) return false; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment