From: Jérôme Benoit Date: Sat, 8 Apr 2023 13:06:48 +0000 (+0200) Subject: fix: strict number check X-Git-Tag: v1.2.3~2 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=260f9dcc04f0680f7ef3f01d859a1f2fa748c07c;p=e-mobility-charging-stations-simulator.git fix: strict number check Signed-off-by: Jérôme Benoit --- diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index b2333fde..a4dfd0b3 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -190,7 +190,7 @@ export class PerformanceStatistics { } const sortedDataSet = dataSet.slice().sort((a, b) => a - b); const middleIndex = Math.floor(sortedDataSet.length / 2); - if (sortedDataSet.length % 2) { + if (sortedDataSet.length % 2 === 0) { return sortedDataSet[middleIndex / 2]; } return (sortedDataSet[middleIndex - 1] + sortedDataSet[middleIndex]) / 2; diff --git a/src/utils/CircularArray.ts b/src/utils/CircularArray.ts index 439f0827..539688cc 100644 --- a/src/utils/CircularArray.ts +++ b/src/utils/CircularArray.ts @@ -79,7 +79,7 @@ export class CircularArray extends Array { return this.length === this.size; } - private checkSize(size: number) { + private checkSize(size: number): void { if (!Number.isSafeInteger(size)) { throw new TypeError(`Invalid circular array size: ${size} is not a safe integer`); }