Reference · Draw a bracket, a table or a road to the final
rankingRanksfunction
The ranks of a list, in order: an entry's own rank, else its position, with equal points sharing a rank; null for a champion row. Pure; takes the list as it is ordered.
Import it
import { rankingRanks } from "@johnmorrisdotca/taisen-brackets";
Definition
function rankingRanks(entries: readonly RankingEntry[], options?: { ties?: boolean; }): (number | null)[]
Parameters
| Name | Type | Description |
|---|---|---|
entries | readonly RankingEntry[] | The entries, in the order they are listed. |
options (optional) | { ties?: boolean; } |
|
Returns
(number | null)[]
The ranks, one for each entry; null for an entry that has no points.
Examples
import { rankingRanks } from "@johnmorrisdotca/taisen-brackets";
const entries = Array.from({ length: 6 }, (_, i) => ({ name: `Athlete ${i + 1}`, points: 100 - Math.floor(i / 2) * 3 }));
console.log(rankingRanks(entries).join(" "));1 1 3 3 5 5What it prints (run when this page was built)