From 4e1c771b331a8e3f42aa83eced5673df93d2df49 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 16 Sep 2023 10:27:45 +0200 Subject: [PATCH] refactor: cleanup standard deviation implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils/StatisticUtils.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/StatisticUtils.ts b/src/utils/StatisticUtils.ts index 7f338ff9..f0bd1f28 100644 --- a/src/utils/StatisticUtils.ts +++ b/src/utils/StatisticUtils.ts @@ -69,8 +69,7 @@ export const stdDeviation = ( dataSetAverage: number = average(dataSet), ): number => { return Math.sqrt( - dataSet.reduce((accumulator, num) => { - return accumulator + Math.pow(num - dataSetAverage, 2); - }, 0) / dataSet.length, + dataSet.reduce((accumulator, num) => accumulator + Math.pow(num - dataSetAverage, 2), 0) / + dataSet.length, ); }; -- 2.34.1