From: Jérôme Benoit Date: Fri, 14 Oct 2022 11:46:03 +0000 (+0200) Subject: Strict boolean checks X-Git-Tag: v1.1.82~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=5f7e72c1538ebf67dc5de3c29840f7b4da6704f8;p=e-mobility-charging-stations-simulator.git Strict boolean checks Signed-off-by: Jérôme Benoit --- 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;