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 e269a54 commit 0038ad9
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/stats/cold.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ const findClosestMean = function (

const findHotIndex = function (
array,
{ mean, minIndex, maxIndex, filter, incrementalMeanMin, incrementalMeanMax },
{ minIndex, maxIndex, filter, incrementalMeanMin, incrementalMeanMax },
) {
let closestMeanDiff = Number.POSITIVE_INFINITY
let sum = 0
let index = -1
let filteredIndex = 0
Expand All @@ -200,13 +199,7 @@ const findHotIndex = function (

const incrementalMean = sum / filteredIndex

if (mean !== undefined) {
const meanDiff = Math.abs(mean - incrementalMean)

if (closestMeanDiff > meanDiff) {
closestMeanDiff = meanDiff
}
} else if (
if (
incrementalMean >= incrementalMeanMin &&
incrementalMean <= incrementalMeanMax
) {
Expand Down

0 comments on commit 0038ad9

Please sign in to comment.