benchmarks/index.js
function logInfo () {
	console.log(`Running on node ${process.version} with ${os.cpus()[0].model} x ${os.cpus().length}`);
	console.log('');
	console.log('Testing:');

	var columns = columnsCreate(['name', 'version', 'homepage']);

	var infoStatic = require('serve-static/package.json');
	infoStatic.version = 'v' + infoStatic.version;
	columnsUpdate(columns, infoStatic);

	var infoStatique = require('statique/package.json');
	infoStatique.version = 'v' + infoStatique.version;
	columnsUpdate(columns, infoStatique);

	var infoFiles = require('../package.json');
	infoFiles.version = 'v' + infoFiles.version;
	columnsUpdate(columns, infoFiles);

	console.log('- ' + columnsText(columns, infoStatic));
	console.log('- ' + columnsText(columns, infoStatique));
	console.log('- ' + columnsText(columns, infoFiles));
	console.log('');

	function columnsCreate (names) {
		return names.map(name => {
			return {size: 0, source: name};
		});
	}

	function columnsUpdate (columns, info) {
		var size;
		var col;
		for (var i = 0; i < columns.length; i++) {
			col = columns[i];
			size = (info[col.source] && info[col.source].length) || 0;
			if (info[col.source] && (size = info[col.source].length) && size > col.size) {
				col.size = size;
			}
		}
	}

	function columnsText (columns, info) {
		var result = '';

		for (var i = 0; i < columns.length; i++) {
			result += columnText(columns[i], info);
			result += ' ';
		}

		return result + ' ';
	}

	function columnText (column, info) {
		var value = info[column.source] || '';
		var padSize = column.size - value.length;
		var pad = '';

		if (padSize) {
			pad += (new Array(padSize + 1)).join(' ');
		}

		return value + pad;
	}
}
function logInfo () {
	console.log(`Running on node ${process.version} with ${os.cpus()[0].model} x ${os.cpus().length}`);
	console.log('');
	console.log('Testing:');

	var columns = columnsCreate(['name', 'version', 'homepage']);

	var infoStatic = require('serve-static/package.json');
	infoStatic.version = 'v' + infoStatic.version;
	columnsUpdate(columns, infoStatic);

	var infoStatique = require('statique/package.json');
	infoStatique.version = 'v' + infoStatique.version;
	columnsUpdate(columns, infoStatique);

	var infoFiles = require('../package.json');
	infoFiles.version = 'v' + infoFiles.version;
	columnsUpdate(columns, infoFiles);

	console.log('- ' + columnsText(columns, infoStatic));
	console.log('- ' + columnsText(columns, infoStatique));
	console.log('- ' + columnsText(columns, infoFiles));
	console.log('');

	function columnsCreate (names) {
		return names.map(name => {
			return {size: 0, source: name};
		});
	}

	function columnsUpdate (columns, info) {
		var size;
		var col;
		for (var i = 0; i < columns.length; i++) {
			col = columns[i];
			size = (info[col.source] && info[col.source].length) || 0;
			if (info[col.source] && (size = info[col.source].length) && size > col.size) {
				col.size = size;
			}
		}
	}

	function columnsText (columns, info) {
		var result = '';

		for (var i = 0; i < columns.length; i++) {
			result += columnText(columns[i], info);
			result += ' ';
		}

		return result + ' ';
	}

	function columnText (column, info) {
		var value = info[column.source] || '';
		var padSize = column.size - value.length;
		var pad = '';

		if (padSize) {
			pad += (new Array(padSize + 1)).join(' ');
		}

		return value + pad;
	}
}
function logInfo ( ) { console . log ( ` ${ process . version } ${ os . cpus ( ) [ 0 ] . model } ${ os . cpus ( ) . length } ` ) ; console . log ( '' ) ; console . log ( 'Testing:' ) ; var columns = columnsCreate ( [ 'name' , 'version' , 'homepage' ] ) ; var infoStatic = require ( 'serve-static/package.json' ) ; infoStatic . version = 'v' + infoStatic . version ; columnsUpdate ( columns , infoStatic ) ; var infoStatique = require ( 'statique/package.json' ) ; infoStatique . version = 'v' + infoStatique . version ; columnsUpdate ( columns , infoStatique ) ; var infoFiles = require ( '../package.json' ) ; infoFiles . version = 'v' + infoFiles . version ; columnsUpdate ( columns , infoFiles ) ; console . log ( '- ' + columnsText ( columns , infoStatic ) ) ; console . log ( '- ' + columnsText ( columns , infoStatique ) ) ; console . log ( '- ' + columnsText ( columns , infoFiles ) ) ; console . log ( '' ) ; function columnsCreate ( names ) { return names . map ( name => { return { size : 0 , source : name } ; } ) ; } function columnsUpdate ( columns , info ) { var size ; var col ; for ( var i = 0 ; i < columns . length ; i ++ ) { col = columns [ i ] ; size = ( info [ col . source ] && info [ col . source ] . length ) || 0 ; if ( info [ col . source ] && ( size = info [ col . source ] . length ) && size > col . size ) { col . size = size ; } } } function columnsText ( columns , info ) { var result = '' ; for ( var i = 0 ; i < columns . length ; i ++ ) { result += columnText ( columns [ i ] , info ) ; result += ' ' ; } return result + ' ' ; } function columnText ( column , info ) { var value = info [ column . source ] || '' ; var padSize = column . size - value . length ; var pad = '' ; if ( padSize ) { pad += ( new Array ( padSize + 1 ) ) . join ( ' ' ) ; } return value + pad ; } }
Show info about environment and tested packages.

@private
Show info about environment and tested packages .