Function: season_latest_with_data()
season_latest_with_data(
season,def?):unknown
Defined in: src/core/transforms.ts:196
sportsdataverse.{nba,wnba}.*_stats_runtime.season_latest_with_data: the season
unchanged (an explicit "" too: every season), or, when unset, the latest season
that has data. Resolved per call, so a long-running process rolls over too; the
flat resolver re-dates it per league, endpoint and SeasonType (redateDefaultSeasons).
Parameters
season
unknown
The caller's season. Any non-nullish value (including "") is returned
as-is; null / undefined are filled.
def?
The flat wrapper's def; def.api === "wnba_stats" fills a WNBA year, any
other (or no) def fills an NBA "YYYY-YY" label.
api?
string
Returns
unknown
The input, or a DefaultSeason wrapping latestSeason("10" | "00").
Remarks
The only transform that fills an unset param instead of passing it through. The
filled value is a DefaultSeason (a String object, not a primitive); compare with
String(v) or let redateDefaultSeasons replace it.
Example
import { season_latest_with_data, latestSeason } from "./transforms.js";
season_latest_with_data("2023-24", { api: "nba_stats" }); // "2023-24"
season_latest_with_data("", { api: "wnba_stats" }); // "" (every season)
String(season_latest_with_data(undefined, { api: "nba_stats" })) === latestSeason("00"); // true