本文へ移動

Taisen Brackets対戦

対戦の一覧から、トーナメント表をSVGで描きます。

対戦(たいせん)は、二者が向かい合って勝負することです。 名前について(英語)

目次

リファレンス · トーナメント表・表・決勝までの道を描く

rankingMatchup関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

The head-to-head card for two athletes and their meetings. Throws a RangeError for an athlete with no name, a ranking that is not a whole number from 1, a meeting whose winner is not 0, 1 or null, rows that is not a whole number from 1 to 50, or a bad size or theme.

インポート

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

定義

function rankingMatchup(source: MatchupSource, options?: MatchupOptions): string

引数

名前型説明
sourceMatchupSource

The matchup.

options (省略可)MatchupOptions

The rows, the size, the theme, the precision and the language.

戻り値

string

The SVG, a string that begins with <svg.

例

import { matchupRecord, rankingMatchup, type RankingMeeting } from "@johnmorrisdotca/taisen-brackets";

const meetings: RankingMeeting[] = [
  { date: "2026-09-13", event: "Fall Open", round: "Semi-final", winner: 0, result: "ippon · 2:11" },
  { date: "2026-05-17", event: "Spring Classic", round: "Final", winner: 1, result: "waza-ari · golden score" },
];
const svg = rankingMatchup({
  category: "U18 · Men -60 kg",
  a: { name: { surname: "Nakamura", given: "Kenji" }, rank: 1, points: 412.5 },
  b: { name: { surname: "Brar", given: "Harpreet" }, rank: 2, points: 398 },
  meetings,
}, { precision: 2, size: "square" });
console.log(matchupRecord(meetings).join("–"), svg.includes("PREVIOUS MEETINGS"));
1–1 true

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/taisen-brackets 0.20.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。