Reference · Where every tie sits
singleEliminationfunction
The matchups of a single-elimination bracket for any number of teams, seeded in the standard way: the top seeds meet
the lowest first, and when the number is not a power of two the top seeds have byes. The teams are in seed order
(or carry a seed). No tie has a result yet; fill the results in and call advanceWinners to carry them forward.
Import it
import { singleElimination } from "@johnmorrisdotca/taisen-brackets/layout";
Also exported from: @johnmorrisdotca/taisen-brackets
Definition
function singleElimination(teams: readonly Team[], options?: SingleEliminationOptions): { teams: Team[]; matchups: Matchup[]; }
Parameters
| Name | Type | Description |
|---|---|---|
teams | readonly Team[] | The teams, best seed first. |
options (optional) | SingleEliminationOptions | A third-place match, and a prefix for the ties' ids. |
Returns
{ teams: Team[]; matchups: Matchup[]; }
The teams and the matchups, none played yet, ready for drawBracket.
Examples
import { singleElimination, drawBracket } from "@johnmorrisdotca/taisen-brackets";
const field = singleElimination([{ id: "A", name: "Aurora" }, { id: "B", name: "Harbour" }, { id: "C", name: "Cascade" }, { id: "D", name: "Delta" }]);
console.log(field.matchups.length, drawBracket(field).startsWith("<svg"));3 trueWhat it prints (run when this page was built)