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 e263d44 commit f883b0e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/report/reporters/histogram/abscissa.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ ${labels}`
}

const getBottomLine = function (width, medianIndex) {
return addTick(width, '', medianIndex).padEnd(width, HORIZONTAL_LINE)
}

const addTick = function (width, bottomLine, medianIndex) {
const lineWidth = medianIndex - bottomLine.length
return lineWidth < 0
? bottomLine
: `${bottomLine}${HORIZONTAL_LINE.repeat(lineWidth)}${TICK_MIDDLE}`
const startPadding = medianIndex + TICK_MIDDLE.length
return TICK_MIDDLE.padStart(startPadding, HORIZONTAL_LINE).padEnd(
width,
HORIZONTAL_LINE,
)
}

const getLabels = function (width, median, medianIndex) {
Expand Down

0 comments on commit f883b0e

Please sign in to comment.