Created
June 19, 2014 00:35
-
-
Save danpaz/6774f221a9f73013f8c5 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
// A code sonnet for Utilities | |
util = require( 'util' ); | |
switch( process.argv[2] ) { | |
case 'stdout': | |
util.puts( 'Hello World' ); | |
util.log( 'Console log with a timestamp!' ); | |
break; | |
case 'formatting': | |
var exdate = new Date(); | |
var isdate = util.isDate( exdate ); | |
var formatted = util.format( '%d/%d/%d', | |
exdate.getDate().toString(), | |
exdate.getMonth().toString(), | |
exdate.getFullYear() ); | |
util.puts( 'The date is a date?: ' + isdate + '. And is formatted: ' + formatted ); | |
break; | |
case 'lookattheguts': | |
util.puts( util.inspect( util, { showHidden: true, depth: null, colors: true } ) ); | |
break; | |
case 'sweetstyles': | |
util.puts( util.inspect( util.inspect.styles ) ); | |
util.puts( util.inspect( util.inspect.colors ) ); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment