repositories
/
e-mobility-charging-stations-simulator.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6514a5a
)
refactor: cleanup control flow in statistic helpers
author
Jérôme Benoit
<jerome.benoit@sap.com>
Thu, 1 Feb 2024 16:37:29 +0000
(17:37 +0100)
committer
Jérôme Benoit
<jerome.benoit@sap.com>
Thu, 1 Feb 2024 16:37:29 +0000
(17:37 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/StatisticUtils.ts
patch
|
blob
|
blame
|
history
diff --git
a/src/utils/StatisticUtils.ts
b/src/utils/StatisticUtils.ts
index e4d6ca41835e574b1a322c1ef6c5816f213cdd5e..9ca4398ca76590250de3b1c5a935f42ca373cd6f 100644
(file)
--- a/
src/utils/StatisticUtils.ts
+++ b/
src/utils/StatisticUtils.ts
@@
-74,9
+74,7
@@
export const stdDeviation = (
dataSet: number[],
dataSetAverage: number = average(dataSet)
): number => {
- if (Array.isArray(dataSet) && dataSet.length === 0) {
- return 0
- } else if (Array.isArray(dataSet) && dataSet.length === 1) {
+ if (Array.isArray(dataSet) && (dataSet.length === 0 || dataSet.length === 1)) {
return 0
}
return Math.sqrt(