Skip to content

Commit

Permalink
Move code
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 26, 2021
1 parent b76e293 commit c6b552c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/stats/compute.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ import { getMean } from './sum.js'
// - This would create too many statistics for the average, together with the
// mean and the median.
export const computeStats = function (measures) {
const { outliersMin, outliersMax, minIndex, maxIndex, length, min, max } =
const { outliersMin, outliersMax, minIndex, maxIndex, length } =
getOutliersStats(measures)

const min = measures[minIndex]
const max = measures[maxIndex]
const median = getSortedMedian(measures, { minIndex, maxIndex })
const quantiles = getQuantiles(measures, QUANTILES_SIZE, {
minIndex,
maxIndex,
})

const mean = getMean(measures, { minIndex, maxIndex })

const histogram = getHistogram(measures, {
Expand Down
4 changes: 1 addition & 3 deletions src/stats/outliers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export const getOutliersStats = function (measures) {
outliersMin,
outliersMax,
)
const min = measures[minIndex]
const max = measures[maxIndex]
return { outliersMin, outliersMax, minIndex, maxIndex, length, min, max }
return { outliersMin, outliersMax, minIndex, maxIndex, length }
}

// `Math.round()` rounds towards +Inf:
Expand Down

0 comments on commit c6b552c

Please sign in to comment.