From 09e7638c89fb5aa12e5e7d44ceccbbe85403d94b Mon Sep 17 00:00:00 2001
From: MatthewFlamm <39341281+MatthewFlamm@users.noreply.github.com>
Date: Mon, 18 Nov 2019 03:00:50 -0500
Subject: [PATCH] fix evaluating to false and remove ; (#4228)
---
.../more-info/controls/more-info-weather.ts | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/dialogs/more-info/controls/more-info-weather.ts b/src/dialogs/more-info/controls/more-info-weather.ts
index 8d14f80cac..8307ae37fd 100644
--- a/src/dialogs/more-info/controls/more-info-weather.ts
+++ b/src/dialogs/more-info/controls/more-info-weather.ts
@@ -87,7 +87,7 @@ class MoreInfoWeather extends LitElement {
${this.stateObj.attributes.temperature} ${this.getUnit("temperature")}
- ${this.stateObj.attributes.pressure
+ ${this._showValue(this.stateObj.attributes.pressure)
? html`
@@ -101,7 +101,7 @@ class MoreInfoWeather extends LitElement {
`
: ""}
- ${this.stateObj.attributes.humidity
+ ${this._showValue(this.stateObj.attributes.humidity)
? html`
@@ -112,7 +112,7 @@ class MoreInfoWeather extends LitElement {
`
: ""}
- ${this.stateObj.attributes.wind_speed
+ ${this._showValue(this.stateObj.attributes.wind_speed)
? html`
@@ -128,7 +128,7 @@ class MoreInfoWeather extends LitElement {
`
: ""}
- ${this.stateObj.attributes.visibility
+ ${this._showValue(this.stateObj.attributes.visibility)
? html`
@@ -156,14 +156,14 @@ class MoreInfoWeather extends LitElement {
>
`
: ""}
- ${!item.templow
+ ${!this._showValue(item.templow)
? html`
${this.computeDateTime(item.datetime)}
`
: ""}
- ${item.templow
+ ${this._showValue(item.templow)
? html`
${this.computeDate(item.datetime)}
@@ -172,7 +172,7 @@ class MoreInfoWeather extends LitElement {
${item.templow} ${this.getUnit("temperature")}
`
- : ""};
+ : ""}
${item.temperature} ${this.getUnit("temperature")}
@@ -279,6 +279,10 @@ class MoreInfoWeather extends LitElement {
}
return `${speed} ${this.getUnit("length")}/h`;
}
+
+ private _showValue(item: string): boolean {
+ return typeof item !== "undefined" && item !== null;
+ }
}
declare global {