Skip to content

Instantly share code, notes, and snippets.

@juanpasolano
Last active December 22, 2015 08:08
Show Gist options
  • Save juanpasolano/6442610 to your computer and use it in GitHub Desktop.
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
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