Last active
December 22, 2015 08:08
-
-
Save juanpasolano/6442610 to your computer and use it in GitHub Desktop.
Object dumbp funciton for debuggin in android or others where console.log is not enough
This file contains hidden or 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
window.ObjectDump = function(obj, name) { | |
this.result = "[ " + name + " ]\n"; | |
this.indent = 0; | |
this.dumpLayer = function(obj) { | |
this.indent += 2; | |
for (var i in obj) { | |
if(typeof(obj[i]) == "object") { | |
this.result += "\n" + | |
" ".substring(0,this.indent) + i + | |
": " + "\n"; | |
this.dumpLayer(obj[i]); | |
} else { | |
this.result += | |
" ".substring(0,this.indent) + i + | |
": " + obj[i] + "\n"; | |
} | |
} | |
this.indent -= 2; | |
}; | |
this.showResult = function() { | |
// var pre = document.createElement('pre'); | |
// pre.innerHTML = this.result; | |
console.log(this.result); | |
}; | |
this.dumpLayer(obj); | |
this.showResult(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment