@nukleus-sports/core 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +16 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -66,8 +66,10 @@ __export(src_exports, {
|
|
|
66
66
|
getSeasonTypeOptions: () => getSeasonTypeOptions,
|
|
67
67
|
getSeasonYearOptions: () => getSeasonYearOptions,
|
|
68
68
|
getStatRankingFootnotes: () => getStatRankingFootnotes,
|
|
69
|
+
getTeamConferenceInfo: () => getTeamConferenceInfo,
|
|
69
70
|
getTeamFacilityConfig: () => getTeamFacilityConfig,
|
|
70
71
|
getTeamFactsConfig: () => getTeamFactsConfig,
|
|
72
|
+
getTeamInitials: () => getTeamInitials,
|
|
71
73
|
getTeamPlaceSummaries: () => getTeamPlaceSummaries,
|
|
72
74
|
getTeamRankingConfigIds: () => getTeamRankingConfigIds,
|
|
73
75
|
getTeamStatColumns: () => getTeamStatColumns,
|
|
@@ -752,15 +754,15 @@ function getPreferredSeasonType(types) {
|
|
|
752
754
|
return Math.max(...types);
|
|
753
755
|
}
|
|
754
756
|
function getSeasonYearOptions(seasons) {
|
|
755
|
-
const years = [...new Set(seasons.map((s) => s.
|
|
757
|
+
const years = [...new Set(seasons.map((s) => s.year))].sort((a, b) => b - a);
|
|
756
758
|
return years.map((year) => ({
|
|
757
759
|
value: year,
|
|
758
|
-
label: seasons.find((s) => s.
|
|
760
|
+
label: seasons.find((s) => s.year === year)?.year_display ?? String(year)
|
|
759
761
|
}));
|
|
760
762
|
}
|
|
761
763
|
function getSeasonTypeOptions(seasons, selectedYear) {
|
|
762
764
|
if (selectedYear === null) return [];
|
|
763
|
-
return seasons.filter((s) => s.
|
|
765
|
+
return seasons.filter((s) => s.year === selectedYear).sort((a, b) => a.type - b.type).map((s) => ({ value: s.type, label: s.type_name }));
|
|
764
766
|
}
|
|
765
767
|
|
|
766
768
|
// src/recentGamesSelection.ts
|
|
@@ -1457,6 +1459,17 @@ function buildRecentGameRows({
|
|
|
1457
1459
|
};
|
|
1458
1460
|
});
|
|
1459
1461
|
}
|
|
1462
|
+
|
|
1463
|
+
// src/teamHeader.ts
|
|
1464
|
+
function getTeamInitials(team) {
|
|
1465
|
+
const words = team?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
1466
|
+
if (words.length === 0) return "T";
|
|
1467
|
+
return words.length > 1 ? words[0][0] + words[1][0] : words[0].substring(0, 2);
|
|
1468
|
+
}
|
|
1469
|
+
function getTeamConferenceInfo(conference, division) {
|
|
1470
|
+
if (!conference && !division) return "Conference - Division";
|
|
1471
|
+
return `${conference || ""} ${division || ""}`.trim();
|
|
1472
|
+
}
|
|
1460
1473
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1461
1474
|
0 && (module.exports = {
|
|
1462
1475
|
BASEBALL_TEAM_STAT_IDS,
|
|
@@ -1505,8 +1518,10 @@ function buildRecentGameRows({
|
|
|
1505
1518
|
getSeasonTypeOptions,
|
|
1506
1519
|
getSeasonYearOptions,
|
|
1507
1520
|
getStatRankingFootnotes,
|
|
1521
|
+
getTeamConferenceInfo,
|
|
1508
1522
|
getTeamFacilityConfig,
|
|
1509
1523
|
getTeamFactsConfig,
|
|
1524
|
+
getTeamInitials,
|
|
1510
1525
|
getTeamPlaceSummaries,
|
|
1511
1526
|
getTeamRankingConfigIds,
|
|
1512
1527
|
getTeamStatColumns,
|