Skip to content

Instantly share code, notes, and snippets.

@TravisMullen
Last active February 8, 2016 21:42
Show Gist options
  • Save TravisMullen/3a20f75650c9eceb2851 to your computer and use it in GitHub Desktop.
Save TravisMullen/3a20f75650c9eceb2851 to your computer and use it in GitHub Desktop.
Matching Object Hash
var alpha = {
'a': {
'random data': {}
},
'b': {
'more random data': {}
}
}, // object hash
beta = {
'a': true,
'b': false
}; // hash to be compared
if ( Object.keys( alpha ).sort().toString().indexOf( Object.keys( beta ).sort().toString() ) === -1 ) {
// true because the keys in each object match
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment