Skip to content

Commit 7f4a751

Browse files
committed
👌 IMPROVE: Lingo
1 parent 5cb3f2b commit 7f4a751

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

utils/getCountries.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const axios = require('axios');
22
const chalk = require('chalk');
3+
const cyan = chalk.cyan;
4+
const dim = chalk.dim;
35
const comma = require('comma-number');
46
const { sortingKeys } = require('./table.js');
57
const to = require('await-to-js').default;
@@ -41,15 +43,13 @@ module.exports = async (
4143
comma(oneCountry.recovered),
4244
comma(oneCountry.active),
4345
comma(oneCountry.critical),
44-
comma(oneCountry.casesPerOneMillion),
46+
comma(oneCountry.casesPerOneMillion)
4547
]);
4648
});
4749

4850
spinner.stopAndPersist();
49-
spinner.info(`${chalk.cyan(`Sorted by:`)} ${sortBy}`);
50-
if (reverse !== undefined) {
51-
spinner.info(`${chalk.cyan(`Order:`)} reverse`);
52-
}
51+
const isRev = reverse ? `${dim(` & `)}${cyan(`Order`)}: reversed` : ``;
52+
spinner.info(`${cyan(`Sorted by:`)} ${sortBy}${isRev}`);
5353
console.log(table.toString());
5454
}
5555
};

utils/getStates.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const axios = require('axios');
22
const chalk = require('chalk');
3+
const cyan = chalk.cyan;
4+
const dim = chalk.dim;
35
const comma = require('comma-number');
46
const { sortingStateKeys } = require('./table.js');
57
const to = require('await-to-js').default;
@@ -27,15 +29,13 @@ module.exports = async (spinner, table, states, sortBy, reverse) => {
2729
comma(oneState.todayCases),
2830
comma(oneState.deaths),
2931
comma(oneState.todayDeaths),
30-
comma(oneState.active),
32+
comma(oneState.active)
3133
]);
3234
});
3335

3436
spinner.stopAndPersist();
35-
spinner.info(`${chalk.cyan(`Sorted by:`)} ${sortBy}`);
36-
if (reverse !== undefined) {
37-
spinner.info(`${chalk.cyan(`Order:`)} reverse`);
38-
}
37+
const isRev = reverse ? `${dim(` & `)}${cyan(`Order`)}: reversed` : ``;
38+
spinner.info(`${cyan(`Sorted by:`)} ${sortBy}${isRev}`);
3939
console.log(table.toString());
4040
}
4141
};

0 commit comments

Comments
 (0)