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
var print = function( o, maxLevel, level ) | |
{ | |
if ( typeof level == "undefined" ) | |
{ | |
level = 0; | |
} | |
if ( typeof maxlevel == "undefined" ) | |
{ | |
maxLevel = 0; | |
} |
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
/** | |
* When investigating a selenium test failure on a remote headless browser that couldn't be reproduced | |
* locally, I wanted to add some javascript to the site under test that would dump some state to the | |
* page (so it could be captured by Selenium as a screenshot when the test failed). JSON.stringify() | |
* didn't work because the object declared a toJSON() method, and JSON.stringify() just calls that | |
* method if it's present. This was a Moment object, so toJSON() returned a string but I wanted to see | |
* the internal state of the object instead. | |
* | |
* So, this is a rough and ready function that recursively dumps any old javascript object. | |
*/ |