Reference · Draw a bracket, a table or a road to the final
medalRanksfunction
The ranks of a list of rows, as medalTable draws them ([1, 2, 2, 4]), in the order they are drawn.
Import it
import { medalRanks } from "@johnmorrisdotca/taisen-brackets";
Definition
function medalRanks(rows: readonly MedalRow[], options?: Pick<MedalTableOptions, "sort" | "ties">): number[]
Parameters
| Name | Type | Description |
|---|---|---|
rows | readonly MedalRow[] | The rows, in the order they are listed. |
options (optional) | Pick<MedalTableOptions, "ties" | "sort"> |
|
Returns
number[]
The ranks, one for each row.
Examples
import { medalRanks } from "@johnmorrisdotca/taisen-brackets";
const rows = [{ name: "A", gold: 1 }, { name: "B", gold: 1 }, { name: "C", silver: 3 }, { name: "D", silver: 1 }];
console.log(medalRanks(rows).join(" "), medalRanks(rows, { sort: "total" }).join(" "));1 1 3 4 1 2 2 4What it prints (run when this page was built)