Skip to content

Instantly share code, notes, and snippets.

@msikma
Created July 22, 2015 11:38
Show Gist options
  • Save msikma/14ff35c878b06780ef9a to your computer and use it in GitHub Desktop.
Save msikma/14ff35c878b06780ef9a to your computer and use it in GitHub Desktop.
Which of these styles is nicer?
/**
* Returns server environment information and copyright. This is intended
* only to be displayed inside of a terminal.
*
* @returns {String} Copyright and server environment information
*/
function getServerInfo() {
const engineName = process.title == 'node' ? 'Node.js'
: process.title == 'iojs' ? 'io.js' : '(unknown engine)';
const engineVersion = process.title + ' v' + process.versions.node;
const enginePlatform = process.platform + '-' + process.arch;
return (
copyrightInfo.string('source', true) + os.EOL
+ version + os.EOL
+ 'Running on ' + engineName + ' ('
+ engineVersion + ', ' + enginePlatform + ')' + os.EOL
);
}
/**
* Returns server environment information and copyright. This is intended
* only to be displayed inside of a terminal.
*
* @returns {String} Copyright and server environment information
*/
function getServerInfo() {
let output = '';
const engineName = process.title == 'node' ? 'Node.js'
: process.title == 'iojs' ? 'io.js' : '(unknown engine)';
const engineVersion = process.title + ' v' + process.versions.node;
const enginePlatform = process.platform + '-' + process.arch;
output += copyrightInfo.string('source', true) + os.EOL;
output += version + os.EOL;
output += 'Running on ' + engineName + ' ('
+ engineVersion + ', ' + enginePlatform + ')' + os.EOL;
return output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment