medalTable関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The medal table as an SVG. Throws a RangeError for a row with no name, a medal count that is not a whole number from 0, an option that is not one of its values, or a bad size or theme.
インポート
import { medalTable } from "@johnmorrisdotca/taisen-brackets";
定義
function medalTable(source: MedalTableSource, options?: MedalTableOptions): string
引数
| 名前 | 型 | 説明 |
|---|---|---|
source | MedalTableSource | The title, the event and the rows. |
options (省略可) | MedalTableOptions | The sort, ties, rows, columns, the size, the theme and the language. |
戻り値
string
The SVG, a string that begins with <svg.
例
import { medalTable } from "@johnmorrisdotca/taisen-brackets";
const svg = medalTable({
subtitle: "Men's judo +100 kg",
rows: [
{ name: "France", flag: "FR", gold: 6, silver: 1, bronze: 3 },
{ name: "Japan", flag: "JP", gold: 5, silver: 3, bronze: 2 },
{ name: "Soviet Union", code: "URS", note: "1922–1991", gold: 1, bronze: 4 },
],
}, { size: "portrait" });
console.log(svg.includes("Soviet Union"), svg.includes("1922–1991"), svg.includes("URS"));true true true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。