Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Dec 12, 2021
1 parent 67efde2 commit aea42ee
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/stats/cold.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,8 @@ const getColdLoopsTarget = function (
const incrementalMeanMin = mean * (1 - precisionTarget)
const incrementalMeanMax = mean * (1 + precisionTarget)
const minIndex = getIndexFromLength(COLD_MIN_PERCENTAGE, length)
const maxIndex = length - 1
const hotIndex = findHotIndex(array, {
minIndex,
maxIndex,
filter,
incrementalMeanMin,
incrementalMeanMax,
Expand Down Expand Up @@ -165,15 +163,15 @@ const findClosestMean = function (array, { mean, minIndex, maxIndex, filter }) {

const findHotIndex = function (
array,
{ minIndex, maxIndex, filter, incrementalMeanMin, incrementalMeanMax },
{ minIndex, filter, incrementalMeanMin, incrementalMeanMax },
) {
let sum = 0
let filteredIndex = 0
let incrementalMean = 0

for (
let index = 0;
filteredIndex !== maxIndex &&
index !== array.length &&
(filteredIndex <= minIndex ||
incrementalMean < incrementalMeanMin ||
incrementalMean > incrementalMeanMax);
Expand Down

0 comments on commit aea42ee

Please sign in to comment.