Skip to content

Commit

Permalink
fix(func): median was sometimes wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Feb 5, 2021
1 parent f3cc5f4 commit c36dda7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/graphEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export default class GraphEntry {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const itemsDup = this._filterNulls([...items]).sort((a, b) => a[1]! - b[1]!);
const mid = Math.floor((itemsDup.length - 1) / 2);
if (itemsDup.length % 2 === 1) return itemsDup[mid];
if (itemsDup.length % 2 === 1) return itemsDup[mid][1];
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return (itemsDup[mid][1]! + itemsDup[mid + 1][1]!) / 2;
}
Expand Down

0 comments on commit c36dda7

Please sign in to comment.