use short if in weatherforecast.js, add comment to logger.js

This commit is contained in:
Karsten Hassel 2021-06-15 23:29:07 +02:00
parent 1d8af5835d
commit a71e61cd30
2 changed files with 5 additions and 12 deletions

View File

@ -35,6 +35,7 @@
timeEnd: Function.prototype.bind.call(console.timeEnd, console) timeEnd: Function.prototype.bind.call(console.timeEnd, console)
}; };
// the timeStamp instruction fails when running the tests so it is not added in test environment
if (process.env.NODE_ENV.trim() !== "test") { if (process.env.NODE_ENV.trim() !== "test") {
logLevel.push({ timeStamp: Function.prototype.bind.call(console.timeStamp, console) }); logLevel.push({ timeStamp: Function.prototype.bind.call(console.timeStamp, console) });
} }

View File

@ -340,12 +340,8 @@ Module.register("weatherforecast", {
* argument data object - Weather information received form openweather.org. * argument data object - Weather information received form openweather.org.
*/ */
processWeather: function (data, momenttz) { processWeather: function (data, momenttz) {
let mom; let mom = momenttz ? momenttz : moment; // Exception last.
if (momenttz === null) {
mom = moment;
} else {
mom = momenttz;
}
// Forcast16 (paid) API endpoint provides this data. Onecall endpoint // Forcast16 (paid) API endpoint provides this data. Onecall endpoint
// does not. // does not.
if (data.city) { if (data.city) {
@ -489,12 +485,8 @@ Module.register("weatherforecast", {
* This code finds all forecasts that is for the same day and sums the amount of rain and returns that. * This code finds all forecasts that is for the same day and sums the amount of rain and returns that.
*/ */
processRain: function (forecast, allForecasts, momenttz) { processRain: function (forecast, allForecasts, momenttz) {
let mom; let mom = momenttz ? momenttz : moment; // Exception last.
if (momenttz === null) {
mom = moment;
} else {
mom = momenttz;
}
//If the amount of rain actually is a number, return it //If the amount of rain actually is a number, return it
if (!isNaN(forecast.rain)) { if (!isNaN(forecast.rain)) {
return forecast.rain; return forecast.rain;