mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-22 13:09:26 +00:00
Add no-param-reassign from eslint (#3089)
While waiting for the easterbunny I cleaned up some bad coding practice :-) Very open for comments especially regarding the places I commented myself... --------- Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
@@ -218,29 +218,30 @@ Module.register("weather", {
|
||||
this.nunjucksEnvironment().addFilter(
|
||||
"unit",
|
||||
function (value, type, valueUnit) {
|
||||
let formattedValue;
|
||||
if (type === "temperature") {
|
||||
value = `${this.roundValue(WeatherUtils.convertTemp(value, this.config.tempUnits))}°`;
|
||||
formattedValue = `${this.roundValue(WeatherUtils.convertTemp(value, this.config.tempUnits))}°`;
|
||||
if (this.config.degreeLabel) {
|
||||
if (this.config.tempUnits === "metric") {
|
||||
value += "C";
|
||||
formattedValue += "C";
|
||||
} else if (this.config.tempUnits === "imperial") {
|
||||
value += "F";
|
||||
formattedValue += "F";
|
||||
} else {
|
||||
value += "K";
|
||||
formattedValue += "K";
|
||||
}
|
||||
}
|
||||
} else if (type === "precip") {
|
||||
if (value === null || isNaN(value) || value === 0 || value.toFixed(2) === "0.00") {
|
||||
value = "";
|
||||
formattedValue = "";
|
||||
} else {
|
||||
value = WeatherUtils.convertPrecipitationUnit(value, valueUnit, this.config.units);
|
||||
formattedValue = WeatherUtils.convertPrecipitationUnit(value, valueUnit, this.config.units);
|
||||
}
|
||||
} else if (type === "humidity") {
|
||||
value += "%";
|
||||
formattedValue = `${value}%`;
|
||||
} else if (type === "wind") {
|
||||
value = WeatherUtils.convertWind(value, this.config.windUnits);
|
||||
formattedValue = WeatherUtils.convertWind(value, this.config.windUnits);
|
||||
}
|
||||
return value;
|
||||
return formattedValue;
|
||||
}.bind(this)
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user