playball 3.1.1 → 3.1.3
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.
|
@@ -11,12 +11,15 @@ const formatPitcherName = pitcher => {
|
|
|
11
11
|
return display;
|
|
12
12
|
};
|
|
13
13
|
const formatTeam = (teams, probables, boxscore, homeAway) => {
|
|
14
|
-
|
|
14
|
+
var _probables$homeAway;
|
|
15
|
+
const pitcherId = (_probables$homeAway = probables[homeAway]) === null || _probables$homeAway === void 0 ? void 0 : _probables$homeAway.id;
|
|
15
16
|
const pitcher = boxscore[homeAway].players['ID' + pitcherId];
|
|
16
17
|
let lines = [teams[homeAway].teamName, `(${teams[homeAway].record.wins}-${teams[homeAway].record.losses})`];
|
|
17
18
|
if (pitcher) {
|
|
18
19
|
var _pitcher$seasonStats, _pitcher$seasonStats2, _pitcher$seasonStats3, _pitcher$seasonStats4;
|
|
19
20
|
lines = lines.concat(['', formatPitcherName(pitcher), `${(_pitcher$seasonStats = pitcher.seasonStats) === null || _pitcher$seasonStats === void 0 || (_pitcher$seasonStats = _pitcher$seasonStats.pitching) === null || _pitcher$seasonStats === void 0 ? void 0 : _pitcher$seasonStats.wins}-${(_pitcher$seasonStats2 = pitcher.seasonStats) === null || _pitcher$seasonStats2 === void 0 || (_pitcher$seasonStats2 = _pitcher$seasonStats2.pitching) === null || _pitcher$seasonStats2 === void 0 ? void 0 : _pitcher$seasonStats2.losses}`, `${(_pitcher$seasonStats3 = pitcher.seasonStats) === null || _pitcher$seasonStats3 === void 0 || (_pitcher$seasonStats3 = _pitcher$seasonStats3.pitching) === null || _pitcher$seasonStats3 === void 0 ? void 0 : _pitcher$seasonStats3.era} ERA ${(_pitcher$seasonStats4 = pitcher.seasonStats) === null || _pitcher$seasonStats4 === void 0 || (_pitcher$seasonStats4 = _pitcher$seasonStats4.pitching) === null || _pitcher$seasonStats4 === void 0 ? void 0 : _pitcher$seasonStats4.strikeOuts} K`]);
|
|
21
|
+
} else {
|
|
22
|
+
lines = lines.concat(['TBD']);
|
|
20
23
|
}
|
|
21
24
|
return lines;
|
|
22
25
|
};
|
|
@@ -7,9 +7,10 @@ function formatHeaderRow(record) {
|
|
|
7
7
|
return record.division.nameShort.padEnd(15) + ' W' + ' L' + ' PCT' + ' GB' + ' WCGB' + ' L10' + ' STRK';
|
|
8
8
|
}
|
|
9
9
|
function formatTeamRow(record) {
|
|
10
|
+
var _record$streak;
|
|
10
11
|
const lastTen = record.records.splitRecords.find(o => o.type === 'lastTen');
|
|
11
12
|
const star = teamFavoriteStar(record.team);
|
|
12
|
-
return star + record.team.teamName.padEnd(star ? 13 : 15) + record.wins.toString().padStart(5) + record.losses.toString().padStart(5) + record.winningPercentage.padStart(7) + record.gamesBack.padStart(6) + record.wildCardGamesBack.padStart(6) + `${lastTen.wins}-${lastTen.losses}`.padStart(6) + record.streak.streakCode.padStart(5);
|
|
13
|
+
return star + record.team.teamName.padEnd(star ? 13 : 15) + record.wins.toString().padStart(5) + record.losses.toString().padStart(5) + record.winningPercentage.padStart(7) + record.gamesBack.padStart(6) + record.wildCardGamesBack.padStart(6) + `${lastTen.wins}-${lastTen.losses}`.padStart(6) + (((_record$streak = record.streak) === null || _record$streak === void 0 ? void 0 : _record$streak.streakCode) || '').padStart(5);
|
|
13
14
|
}
|
|
14
15
|
function Division({
|
|
15
16
|
record,
|
package/dist/utils.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { get } from "./config.js";
|
|
2
2
|
const FAVORITES = get('favorites');
|
|
3
3
|
export function teamFavoriteStar(team) {
|
|
4
|
+
const style = get('color.favorite-star') + '-fg';
|
|
4
5
|
if (FAVORITES.includes(team.abbreviation)) {
|
|
5
|
-
return `{${
|
|
6
|
+
return `{${style}}★{/${style}} `;
|
|
6
7
|
}
|
|
7
8
|
return '';
|
|
8
9
|
}
|