Function: loadLeague()
loadLeague(
league):Promise<LeagueData>
Defined in: packages/sdvplot/src/index-data.ts:33
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" | "cfb" | "cricket" | "echl" | "mbb" | "milb" | "mlb" | "nba" | "nbagl" | "ncaa_baseball" | "ncaa_mhockey" | "ncaa_softball" | "ncaa_whockey" | "nfl" | "nhl" | "ohl" | "phf" | "pwhl" | "qmjhl" | "soccer" | "ufl" | "usfl" | "ushl" | "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");