Skip to content

Instantly share code, notes, and snippets.

@schorfES
Created November 10, 2017 10:55
Show Gist options
  • Save schorfES/e48b2b73ff5a28e933626adb308da745 to your computer and use it in GitHub Desktop.
Save schorfES/e48b2b73ff5a28e933626adb308da745 to your computer and use it in GitHub Desktop.
Dev tools snippet for searching props in objects
console.search = console.search || function (obj, key, path = '.') {
Object.keys(obj).forEach(function(k) {
var o = obj[k];
if (!o) {
return;
}
if (k.toLowerCase() === key.toLowerCase()) {
console.log(path + k);
}
if (typeof o === 'object') {
console.search(o, key, path + k + '.');
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment