Skip to main content

Preload every league, then count teams

{
  "aaf": 8,
  "ahl": 61,
  "cfb": 687,
  "cricket": 111,
  "echl": 59,
  "mbb": 366,
  "milb": 286,
  "mlb": 30,
  "nba": 30,
  "nbagl": 32,
  "ncaa_baseball": 414,
  "ncaa_mhockey": 110,
  "ncaa_softball": 415,
  "ncaa_whockey": 48,
  "nfl": 32,
  "nhl": 32,
  "ohl": 27,
  "phf": 8,
  "pwhl": 12,
  "qmjhl": 30,
  "soccer": 2631,
  "ufl": 11,
  "usfl": 9,
  "ushl": 17,
  "wbb": 364,
  "whl": 23,
  "wnba": 15,
  "xfl": 11
}
import { LEAGUES, preloadAll, teams } from "@sportsdataverse/sdvplot";

// Every league shard plus the gsis map, so every *Sync function works for any league afterwards.
// A server does this once at start-up; a browser page loads only the leagues it draws.
await preloadAll();
const counts: Record<string, number> = {};
for (const league of LEAGUES) counts[league] = (await teams(league)).length;

counts;

Tags: node · preloadAll · teams. All sdvplot examples.