From 5f7e72c1538ebf67dc5de3c29840f7b4da6704f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 14 Oct 2022 13:46:03 +0200 Subject: [PATCH] Strict boolean checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/WorkerBroadcastChannel.ts | 4 ++-- src/performance/PerformanceStatistics.ts | 4 ++-- src/ui/web/src/router/index.ts | 2 +- src/utils/Utils.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/charging-station/WorkerBroadcastChannel.ts b/src/charging-station/WorkerBroadcastChannel.ts index 96fe7c17..c1df1afd 100644 --- a/src/charging-station/WorkerBroadcastChannel.ts +++ b/src/charging-station/WorkerBroadcastChannel.ts @@ -27,11 +27,11 @@ export default abstract class WorkerBroadcastChannel extends BroadcastChannel { } protected isRequest(message: JsonType[]): boolean { - return Array.isArray(message) && message.length === 3; + return Array.isArray(message) === true && message.length === 3; } protected isResponse(message: JsonType[]): boolean { - return Array.isArray(message) && message.length === 2; + return Array.isArray(message) === true && message.length === 2; } protected validateMessageEvent(messageEvent: MessageEvent): MessageEvent | false { diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index d3a174c0..f3cc9e5f 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -172,7 +172,7 @@ export default class PerformanceStatistics { } private median(dataSet: number[]): number { - if (Array.isArray(dataSet) && dataSet.length === 1) { + if (Array.isArray(dataSet) === true && dataSet.length === 1) { return dataSet[0]; } const sortedDataSet = dataSet.slice().sort((a, b) => a - b); @@ -251,7 +251,7 @@ export default class PerformanceStatistics { this.statistics.statisticsData.get(entryName).avgTimeMeasurement = this.statistics.statisticsData.get(entryName).totalTimeMeasurement / this.statistics.statisticsData.get(entryName).countTimeMeasurement; - Array.isArray(this.statistics.statisticsData.get(entryName).timeMeasurementSeries) + Array.isArray(this.statistics.statisticsData.get(entryName).timeMeasurementSeries) === true ? this.statistics.statisticsData .get(entryName) .timeMeasurementSeries.push({ timestamp: entry.startTime, value: entry.duration }) diff --git a/src/ui/web/src/router/index.ts b/src/ui/web/src/router/index.ts index 0857e041..869f8bdd 100644 --- a/src/ui/web/src/router/index.ts +++ b/src/ui/web/src/router/index.ts @@ -2,7 +2,7 @@ import { createRouter, createWebHistory } from 'vue-router'; import type { RouteRecordRaw } from 'vue-router'; import ChargingStationsView from '@/views/ChargingStationsView.vue'; -const routes: Array = [ +const routes: RouteRecordRaw[] = [ { path: '/', name: 'charging-stations', diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 2dff293a..a1b8a8a9 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -189,7 +189,7 @@ export default class Utils { if (!object) { return true; } - if (Array.isArray(object) && object.length > 0) { + if (Array.isArray(object) === true && (object as unknown[]).length > 0) { return false; } return true; -- 2.34.1