Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Last active December 17, 2015 09:29
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 tmtk75/5587683 to your computer and use it in GitHub Desktop.
Save tmtk75/5587683 to your computer and use it in GitHub Desktop.
var toValue = function(it) {
if (typeof it == "string")
return "'" + it + "'";
if (it.constructor === Array)
return "Array[" + it.length + "]";
return it;
}
var showProperties = function(p, obj, indent) {
if (typeof obj == "function") {
return;
}
if (typeof obj == "object" && obj.constructor !== Array) {
for (var p in obj) {
if (obj.hasOwnProperty(p))
showProperties(p, obj[p], indent + " ");
}
return;
}
console.log(indent + p + ":", toValue(obj));
}
var page = new WebPage
showProperties("WebPage", page, "");
phantom.exit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment