From bcc0cc599d65edc21f0de1d5da26d6fff32c48e9 Mon Sep 17 00:00:00 2001 From: veeck Date: Wed, 30 Jun 2021 15:53:51 +0200 Subject: [PATCH] Fix == usages --- modules/default/weather/providers/smhi.js | 4 ++-- modules/default/weather/providers/ukmetofficedatahub.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/default/weather/providers/smhi.js b/modules/default/weather/providers/smhi.js index efcf8bb0..1512b067 100644 --- a/modules/default/weather/providers/smhi.js +++ b/modules/default/weather/providers/smhi.js @@ -60,7 +60,7 @@ WeatherProvider.register("smhi", { */ setConfig(config) { this.config = config; - if (!config.precipitationValue || ["pmin", "pmean", "pmedian", "pmax"].indexOf(config.precipitationValue) == -1) { + if (!config.precipitationValue || ["pmin", "pmean", "pmedian", "pmax"].indexOf(config.precipitationValue) === -1) { console.log("invalid or not set: " + config.precipitationValue); config.precipitationValue = this.defaults.precipitationValue; } @@ -240,7 +240,7 @@ WeatherProvider.register("smhi", { * @param name */ paramValue(currentWeatherData, name) { - return currentWeatherData.parameters.filter((p) => p.name == name).flatMap((p) => p.values)[0]; + return currentWeatherData.parameters.filter((p) => p.name === name).flatMap((p) => p.values)[0]; }, /** diff --git a/modules/default/weather/providers/ukmetofficedatahub.js b/modules/default/weather/providers/ukmetofficedatahub.js index d096c33b..41e84880 100644 --- a/modules/default/weather/providers/ukmetofficedatahub.js +++ b/modules/default/weather/providers/ukmetofficedatahub.js @@ -91,7 +91,7 @@ WeatherProvider.register("ukmetofficedatahub", { this.fetchWeather(this.getUrl("hourly"), this.getHeaders()) .then((data) => { // Check data is useable - if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length == 0) { + if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length === 0) { // Did not receive usable new data. // Maybe this needs a better check? Log.error("Possibly bad current/hourly data?"); @@ -162,7 +162,7 @@ WeatherProvider.register("ukmetofficedatahub", { this.fetchWeather(this.getUrl("daily"), this.getHeaders()) .then((data) => { // Check data is useable - if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length == 0) { + if (!data || !data.features || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length === 0) { // Did not receive usable new data. // Maybe this needs a better check? Log.error("Possibly bad forecast data?"); @@ -258,11 +258,11 @@ WeatherProvider.register("ukmetofficedatahub", { // To use kilometres per hour, use "kph" // Else assumed imperial and the value is returned in miles per hour (a Met Office user is likely to be UK-based) convertWindSpeed(windInMpS) { - if (this.config.windUnits == "mps") { + if (this.config.windUnits === "mps") { return windInMpS; } - if (this.config.windUnits == "kph" || this.config.windUnits == "metric" || this.config.useKmh) { + if (this.config.windUnits === "kph" || this.config.windUnits === "metric" || this.config.useKmh) { return windInMpS * 3.6; }