Skip to content

Instantly share code, notes, and snippets.

@mweibel
Last active August 27, 2020 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mweibel/29704ce506a847bae7298d3744c62c3a to your computer and use it in GitHub Desktop.
Save mweibel/29704ce506a847bae7298d3744c62c3a to your computer and use it in GitHub Desktop.
// dbgObject is useful when you have no access to console.log, to debug (e.g. using alert()) a built-in object.
function dbgObject(obj) {
if (Array.isArray(obj)) {
return obj
}
if (typeof obj !== "object") {
return obj
}
const dbg = {}
for (var k in obj) {
dbg[k] = dbgObject(obj[k])
}
return dbg
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment