Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 12, 2021
1 parent 0601c78 commit 3a5c60e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/report/normalize/stats/decimals.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ export const getStatsDecimals = function (combinations, name, scale) {
.flatMap(({ stats }) => stats[name])
.filter(isDefined)
.map((measure) => Math.abs(measure) / scale)
.filter(isNotZero)

if (measures.every(Number.isInteger)) {
return 0
}

const minMeasure = Math.min(...measures.filter(isNotZero))
const minMeasure = Math.min(...measures)
return getDecimals(minMeasure)
}

Expand All @@ -22,6 +23,7 @@ const isDefined = function (measure) {
return measure !== undefined
}

// `0` is excluded since decimals cannot be inferred from it.
const isNotZero = function (measure) {
return measure !== 0
}
Expand Down

0 comments on commit 3a5c60e

Please sign in to comment.