Created
July 18, 2015 02:36
-
-
Save gffcoutinho/0a9d69a4870f85d741a1 to your computer and use it in GitHub Desktop.
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 console = { | |
log: function( v ) { | |
var str = (function stringify( obj, unquote ) { | |
if ( obj === null ) return 'null'; | |
if ( obj === undefined ) return 'undefined'; | |
if ( obj instanceof Array ) { | |
var str = []; | |
for ( var i = 0; i < obj.length; ++i ) { | |
str.push( stringify( obj[i] )); | |
} | |
return '[ ' + str.join(', ') + ' ]'; | |
} | |
var type = typeof obj; | |
if ( type === 'string' ) { | |
if ( !unquote ) return '"' + obj + '"'; | |
return obj; | |
} | |
if ( type === 'object' ) { | |
var str = []; | |
for ( var p in obj ) { | |
str.push( stringify( p, true ) + ': ' + stringify( obj[p] )); | |
} | |
return '{ ' + str.join(', ') + ' }'; | |
} | |
if ( type === 'function' ) return 'function'; | |
return obj.toString ? obj.toString() : type; | |
})( v ); | |
WScript.Echo( str ); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment