Function: loadLeague()
loadLeague(
league):Promise<LeagueData>
Defined in: packages/sdvplot/src/index-data.ts:42
Load a league's bundled teams, aliases and marks (one code-split chunk; nothing is downloaded). Every *Sync
function needs it first. Async throughout: an unknown league rejects (never throws synchronously); a failed chunk
load can be retried.
Parameters
league
"aaf" | "ahl" | "ajhl" | "bchl" | "cchl" | "cebl" | "cfb" | "cfl" | "chl" | "cricket" | "easl" | "echl" | "f1" | "fiba" | "gojhl" | "iihf" | "kijhl" | "lba" | "mbb" | "mhl" | "milb" | "mjhl" | "mlb" | "nba" | "nbagl" | "nbl" | "ncaa_baseball" | "ncaa_mhockey" | "ncaa_softball" | "ncaa_whockey" | "nfl" | "nhl" | "nojhl" | "ohl" | "ojhl" | "phf" | "pwhl" | "qmjhl" | "sjhl" | "soccer" | "sphl" | "ufl" | "usfl" | "ushl" | "vijhl" | "wbb" | "whl" | "wnba" | "xfl"
Returns
Promise<LeagueData>
Example
import { loadLeague } from "@sportsdataverse/sdvplot";
const nfl = await loadLeague("nfl");
nfl.teams.find((t) => t.abbr === "KC");