Reference · Draw a bracket, a table or a road to the final
medalTablefunction
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 it
import { medalTable } from "@johnmorrisdotca/taisen-brackets";
Definition
function medalTable(source: MedalTableSource, options?: MedalTableOptions): string
Parameters
| Name | Type | Description |
|---|---|---|
source | MedalTableSource | The title, the event and the rows. |
options (optional) | MedalTableOptions | The sort, ties, rows, columns, the size, the theme and the language. |
Returns
string
The SVG, a string that begins with <svg.
Examples
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 trueWhat it prints (run when this page was built)