Code style improvments, to pass SonarCloud review

This commit is contained in:
Alicia Sykes
2021-12-27 00:39:30 +00:00
parent fac3e8e456
commit 15eddb1565
13 changed files with 25 additions and 55 deletions

View File

@@ -40,7 +40,7 @@ export default {
/* The number of data points to render on the chart */
dataPoints() {
const userChoice = this.options.dataPoints;
if (!Number.isNaN(userChoice) && userChoice < 100 && userChoice > 5) {
if (typeof usersChoice === 'number' && userChoice < 100 && userChoice > 5) {
return userChoice;
}
return 30;
@@ -137,8 +137,7 @@ export default {
formatDate(timestamp) {
const localFormat = navigator.language;
const dateFormat = { weekday: 'short', day: 'numeric', month: 'short' };
const date = new Date(timestamp).toLocaleDateString(localFormat, dateFormat);
return date;
return new Date(timestamp).toLocaleDateString(localFormat, dateFormat);
},
/* Format the price, rounding to given number of decimal places */
formatPrice(priceStr) {