Skip to content

Instantly share code, notes, and snippets.

@ruyadorno
Created November 26, 2015 04:17
Show Gist options
  • Save ruyadorno/542be7c032f9b9f4f3b2 to your computer and use it in GitHub Desktop.
Save ruyadorno/542be7c032f9b9f4f3b2 to your computer and use it in GitHub Desktop.
// everyone's better of using a proper solution: https://github.com/Automattic/util-inspect
export function traceme(obj, depth) {
if (depth===0) return;
for (var key in obj) {
if (obj[key] && obj[key].constructor.prototype === Array.prototype) obj[key] = obj[key].toString();
var value = typeof obj[key] === 'object' && obj[key] !== null ? traceme(obj[key], depth-1) : obj[key];
console.log(key + ': ' + value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment