Skip to content

Commit

Permalink
refactor: rename middle to mid
Browse files Browse the repository at this point in the history
  • Loading branch information
wellyshen committed May 28, 2021
1 parent ec3317c commit d155b69
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/findNearestBinarySearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export default (
getVal: (idx: number) => number
): number => {
while (low <= high) {
const middle = ((low + high) / 2) | 0;
const val = getVal(middle);
const mid = ((low + high) / 2) | 0;
const val = getVal(mid);

if (offset < val) {
high = middle - 1;
high = mid - 1;
} else if (offset > val) {
low = middle + 1;
low = mid + 1;
} else {
return middle;
return mid;
}
}

Expand Down

0 comments on commit d155b69

Please sign in to comment.