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
| Name | Type | Description |
|---|---|---|
games | readonly PlayedGame[] | The games, in any order. |
options | GamesOptions | 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"));trueWhat it prints (run when this page was built)