Skip to content

Instantly share code, notes, and snippets.

@jhaynie
Last active December 28, 2015 08:39
Show Gist options
  • Save jhaynie/7473214 to your computer and use it in GitHub Desktop.
Save jhaynie/7473214 to your computer and use it in GitHub Desktop.
function getKeys(obj, keys) {
keys = keys || {};
Object.keys(obj).forEach(function(k){
if (!k in keys) {
var o = obj[k];
keys[k] = 1;
if (typeof o === 'Object') {
getKeys(o,keys);
}
}
});
return keys;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment