refactor: cleanup standard deviation implementation
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 16 Sep 2023 08:27:45 +0000 (10:27 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 16 Sep 2023 08:27:45 +0000 (10:27 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/StatisticUtils.ts

index 7f338ff9d08d88651a6d012b036ef73f43946ec5..f0bd1f28bbc789500e3b0ae41c966dbf9f3ac241 100644 (file)
@@ -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,
   );
 };