Files
blitzkit/src/core/statistics/getWN8Percentile.ts
T

21 lines
636 B
TypeScript
Raw Normal View History

2023-07-11 19:54:57 +00:00
import { Percentile } from '../../constants/percentiles';
2023-06-01 19:16:29 +00:00
2023-06-04 00:01:10 +00:00
export const WN8_PERCENTILES: [number, Percentile][] = [
2023-06-01 19:16:29 +00:00
[0, Percentile.VeryBad],
[300, Percentile.Bad],
[450, Percentile.BelowAverage],
[650, Percentile.Average],
[900, Percentile.AboveAverage],
[1200, Percentile.Good],
[1600, Percentile.VeryGood],
[2000, Percentile.Great],
[2450, Percentile.Unicum],
[2900, Percentile.SuperUnicum],
];
export default function getWN8Percentile(WN8: number) {
const lastIndex = WN8_PERCENTILES.findLastIndex(
([WN8Listing]) => WN8Listing <= WN8,
);
return WN8_PERCENTILES[lastIndex === -1 ? 0 : lastIndex][1];
}