From 260f9dcc04f0680f7ef3f01d859a1f2fa748c07c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 8 Apr 2023 15:06:48 +0200 Subject: [PATCH] fix: strict number check MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/performance/PerformanceStatistics.ts | 2 +- src/utils/CircularArray.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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`); } -- 2.34.1