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 · Where every tie sits

matchupsFromGamesfunction

Matchups from a flat list of games: the games of one pair in one stage become one tie (a replay, two legs or a series), the stage orders the rounds, and the third-place stage becomes the third-place match. The sides of a tie are the home and away of its first game; each game's score is turned to that order.

Import it

import { matchupsFromGames } from "@johnmorrisdotca/taisen-brackets/layout";

Also exported from: @johnmorrisdotca/taisen-brackets

Definition

function matchupsFromGames(games: readonly PlayedGame[], options: GamesOptions): Matchup[]

Parameters

NameTypeDescription
gamesreadonly PlayedGame[]

The games, in any order.

optionsGamesOptions

The stages in order, and which are the third-place match, two-legged ties or series.

Returns

Matchup[]

The matchups, ready for layoutBracket and drawBracket.

Examples

import { drawBracket, matchupsFromGames } from "@johnmorrisdotca/taisen-brackets";

const games = [
  { stage: "Semi-final", home: "Aurora", away: "Harbour", homeScore: 2, awayScore: 1 },
  { stage: "Semi-final", home: "Cascade", away: "Delta", homeScore: 0, awayScore: 1 },
  { stage: "Final", home: "Aurora", away: "Delta", homeScore: 3, awayScore: 1 },
];
console.log(drawBracket(matchupsFromGames(games, { stages: ["Semi-final", "Final"] })).startsWith("<svg"));
true

What it prints (run when this page was built)

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