mirror of
https://github.com/home-assistant/frontend.git
synced 2026-02-15 07:25:54 +00:00
Refactor: Replace Object.keys().includes() with 'in' operator (#27369)
This commit is contained in:
@@ -70,9 +70,7 @@ export class HaMoreInfoSettings extends LitElement {
|
||||
if (!this.entry) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
!Object.keys(PLATFORMS_WITH_SETTINGS_TAB).includes(this.entry.platform)
|
||||
) {
|
||||
if (!(this.entry.platform in PLATFORMS_WITH_SETTINGS_TAB)) {
|
||||
this._settingsElementTag = "entity-registry-settings";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -209,9 +209,7 @@ class OnboardingRestoreBackup extends LitElement {
|
||||
}
|
||||
|
||||
if (this._cloudStatus?.logged_in && !this._backupId) {
|
||||
this._backup = backups.find(({ agents }) =>
|
||||
Object.keys(agents).includes(CLOUD_AGENT)
|
||||
);
|
||||
this._backup = backups.find(({ agents }) => CLOUD_AGENT in agents);
|
||||
|
||||
if (!this._backup) {
|
||||
this._view = "empty_cloud";
|
||||
|
||||
@@ -442,9 +442,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
||||
: nothing}
|
||||
${this._manifest?.is_built_in &&
|
||||
this._manifest.quality_scale &&
|
||||
Object.keys(QUALITY_SCALE_MAP).includes(
|
||||
this._manifest.quality_scale
|
||||
)
|
||||
this._manifest.quality_scale in QUALITY_SCALE_MAP
|
||||
? html`
|
||||
<div class="integration-info">
|
||||
<a
|
||||
|
||||
@@ -222,9 +222,9 @@ export class HuiCreateDialogBadge
|
||||
private _handleBadgePicked(ev) {
|
||||
const config = ev.detail.config;
|
||||
if (this._params!.entities && this._params!.entities.length) {
|
||||
if (Object.keys(config).includes("entities")) {
|
||||
if ("entities" in config) {
|
||||
config.entities = this._params!.entities;
|
||||
} else if (Object.keys(config).includes("entity")) {
|
||||
} else if ("entity" in config) {
|
||||
config.entity = this._params!.entities[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,9 +244,9 @@ export class HuiCreateDialogCard
|
||||
private _handleCardPicked(ev) {
|
||||
const config = ev.detail.config;
|
||||
if (this._params!.entities && this._params!.entities.length) {
|
||||
if (Object.keys(config).includes("entities")) {
|
||||
if ("entities" in config) {
|
||||
config.entities = this._params!.entities;
|
||||
} else if (Object.keys(config).includes("entity")) {
|
||||
} else if ("entity" in config) {
|
||||
config.entity = this._params!.entities[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,8 +129,7 @@ export class HuiStatisticCardEditor
|
||||
name: "period",
|
||||
required: true,
|
||||
selector:
|
||||
selectedPeriodKey &&
|
||||
Object.keys(periods).includes(selectedPeriodKey)
|
||||
selectedPeriodKey && selectedPeriodKey in periods
|
||||
? {
|
||||
select: {
|
||||
multiple: false,
|
||||
|
||||
Reference in New Issue
Block a user