- Integer id columns are decimal strings — Every id column of integers (
id,*_id,game_pk,playerId, …) comes back as exact decimal strings on every surface — parsers, producers, loaders, HockeyTech analytics. Compare and join ids as strings;Number(row.game_id)for a safe number back. (changelog) - 400 / 422 raise
InvalidParameterError— For every family (it wasAssetFetchError), never retried; the message names host, path and status with a redacted excerpt of the body. (changelog) - Typed returns — generated row types for
parsed: true— TypeScript only. A wrapper's raw payload resolves tounknown(wasany); verified endpoints resolve to their row interfaces; the summary dispatchers toParsedTables. Narrow or cast a raw payload. (changelog) - Wrapper failures raise
NoDataError/AssetFetchError— Instead of raw axios errors.NoDataError= the fetch worked and there is nothing there (404, ESPN{ code: 404 });AssetFetchError= the fetch failed (403 / 429 / 5xx after retries, network). Retries followDEFAULT_RETRY_STATUSESwith backoff. (changelog)
Transforms
These utilities never fetch a provider payload by themselves — they transform, classify, configure or look things up. The data surface (every espn* / native wrapper and load* loader) is under ESPN Reference.
Parameter transforms the wrappers apply before a request, and the tidy.js toolkit for the rows after it.
| Export | kind | module |
|---|---|---|
bool_str | function | src/core/transforms.ts |
_bool_str | function | src/core/transforms.ts |
format_nhl_season | function | src/core/transforms.ts |
season_latest_with_data | function | src/core/transforms.ts |
latestSeason | function | src/core/transforms.ts |
redateDefaultSeasons | function | src/core/transforms.ts |
DefaultSeason | class | src/core/transforms.ts |
TRANSFORMS | const | src/core/transforms.ts |
applyTransform | function | src/core/transforms.ts |
ParamTransform | type | src/core/transforms.ts |
tidy | const | src/index.ts |
Sdv | type | src/index.ts |
src/core/transforms.ts
Parameter transforms named in the endpoint YAML (transform:), applied to a resolved argument before the request — ports of the sdv-py runtime functions of the same names.
Import: import { … } from 'sportsdataverse/dist/core/transforms.js'
bool_str
sportsdataverse._codegen_runtime.bool_str — a truthy value sends "true", a falsy one "false".
export function bool_str(value: unknown): unknown
_bool_str
nfl_api_runtime._bool_str — str(value).lower().
export function _bool_str(value: unknown): unknown
format_nhl_season
A 4-digit end year -> the 8-digit NHL api-web season (2025 -> "20242025"); 8 digits pass through.
export function format_nhl_season(season: unknown): unknown
season_latest_with_data
The stats.nba.com / stats.wnba.com season default: the season unchanged, or, when unset, the latest season with rows (re-dated per request).
export function season_latest_with_data(season: unknown, def?: { api?: string }): unknown
latestSeason
The latest season with rows on a date for a league id, endpoint and season type (sdv-py _latest_season).
export function latestSeason( leagueId: string
redateDefaultSeasons
Re-date every wrapper-filled Season / SeasonYear of a query for the request's league, endpoint and SeasonType.
export function redateDefaultSeasons( def: { host?: string; path?: string }, query: Record<string, any>, today: Date
DefaultSeason
A season the wrapper filled in (not the caller's) — what redateDefaultSeasons re-dates.
export class DefaultSeason extends String {}
TRANSFORMS
The transform registry — YAML name -> function.
export const TRANSFORMS: Record<string, ParamTransform> =
applyTransform
Apply a named transform to a value (unknown name throws).
export function applyTransform(name: string | undefined, value: unknown, def?: { api?: string }): unknown
ParamTransform
A transform — resolved value -> wire value.
export type ParamTransform
src/index.ts
The tidy.js toolkit, re-exported so parsed rows can be piped through grammar-of-data verbs.
Import: import { … } from 'sportsdataverse'
tidy
@tidyjs/tidy as a namespace object — tidy.tidy(rows, tidy.groupBy(…), tidy.summarize(…)).
export tidy
Example:
import { tidy } from 'sportsdataverse';
tidy.tidy(rows, tidy.groupBy('team', tidy.summarize({ n: tidy.n() })));
Sdv
The type of the default export — every namespace's generated, legacy and hand-written members.
export type Sdv
Generated by tools/codegen/generate.mjs from tools/codegen/utilities.yaml — see How this library is built.