Skip to content

Commit

Permalink
Close sindresorhus#23 PR: Drops the decimal when more than 10 mbps. F…
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVerschueren authored and sindresorhus committed Oct 2, 2015
1 parent 5de8ce0 commit f8ee1f9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,27 +96,27 @@ st.once('testserver', function (server) {

st.on('downloadspeedprogress', function (speed) {
if (state === 'download' && cli.flags.json !== true) {
var download = roundTo(speed, 1);
var download = roundTo(speed, speed > 10 ? 0 : 1);
stats.download = chalk.yellow(download + chalk.dim(' Mbps'));
}
});

st.on('uploadspeedprogress', function (speed) {
if (state === 'upload' && cli.flags.json !== true) {
var upload = roundTo(speed, 1);
var upload = roundTo(speed, speed > 10 ? 0 : 1);
stats.upload = chalk.yellow(upload + chalk.dim(' Mbps'));
}
});

st.once('downloadspeed', function (speed) {
setState('upload');
var download = roundTo(speed, 1);
var download = roundTo(speed, speed > 10 && !cli.flags.json ? 0 : 1);
stats.download = (cli.flags.json) ? download : chalk.cyan(download + chalk.dim(' Mbps'));
});

st.once('uploadspeed', function (speed) {
setState('');
var upload = roundTo(speed, 1);
var upload = roundTo(speed, speed > 10 && !cli.flags.json ? 0 : 1);
stats.upload = (cli.flags.json) ? upload : chalk.cyan(upload + chalk.dim(' Mbps'));
});

Expand Down

0 comments on commit f8ee1f9

Please sign in to comment.