Skip to main content

One team, three id systems

{
  "auto": [
    "12",
    "12",
    "12"
  ],
  "espn": "12",
  "name": "12",
  "PRIORITY": [
    "team_id",
    "espn",
    "espn_abbr",
    "nhl",
    "nflverse",
    "mlbstats",
    "nba_api",
    "hockeytech",
    "ncaa",
    "pff",
    "cricinfo",
    "cfbd",
    "bref",
    "sportsipy",
    "fangraphs",
    "sdvplotr",
    "name"
  ],
  "EXPLICIT_ONLY": [
    "nhl_id"
  ]
}
import { EXPLICIT_ONLY, PRIORITY, resolve } from "@sportsdataverse/sdvplot";

// "auto" tries the systems in PRIORITY order; the first one holding the value decides.
const auto = await resolve(["12", "KC", "Kansas City Chiefs"], "nfl");
// Name the system when you know it: "12" is ESPN's id for Kansas City.
const espn = await resolve("12", "nfl", { idSystem: "espn" });
const name = await resolve("Kansas City Chiefs", "nfl", { idSystem: "name" });

{
auto,
espn,
name,
PRIORITY,
// Systems "auto" never tries: pass them as idSystem.
EXPLICIT_ONLY,
};

Tags: resolve · idSystem · nfl. All sdvplot examples.