Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Sep 5, 2021
1 parent 5c4abd7 commit 19d710a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/report/reporters/boxplot/box.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ const getMinLine = function (min, q1) {
}

const getQ1Box = function (q1, median) {
const q1BoxWidth = Math.max(median.index - q1.index, 0)
return BOX_CHARACTER.repeat(q1BoxWidth)
return fillCharacter(BOX_CHARACTER, q1, median)
}

const getQ3Box = function (median, q3) {
const q3BoxWidth = Math.max(q3.index - median.index, 0)
return BOX_CHARACTER.repeat(q3BoxWidth)
return fillCharacter(BOX_CHARACTER, median, q3)
}

const fillCharacter = function (character, start, end) {
const width = Math.max(end.index - start.index, 0)
return character.repeat(width)
}

const getMaxLine = function (q3, max) {
Expand Down

0 comments on commit 19d710a

Please sign in to comment.