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

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

NameTypeDescription
entriesreadonly RankingEntry[]

The entries, in the order they are listed.

options (optional){ ties?: boolean; }

ties: false numbers every entry.

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 5

What it prints (run when this page was built)

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