Created
November 26, 2015 04:17
-
-
Save ruyadorno/542be7c032f9b9f4f3b2 to your computer and use it in GitHub Desktop.
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
// 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