Skip to the content

Taisen Brackets対戦

Knockout brackets as SVG, from a list of ties.

Taisen (対戦, たいせん) is Japanese for a matchup: two sides facing each other. About the name

Contents

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

NameTypeDescription
rowsreadonly MedalRow[]

The rows, in the order they are listed.

options (optional)Pick<MedalTableOptions, "ties" | "sort">

sort (gold, total or given) and ties.

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 4

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/taisen-brackets 0.20.0.