UNPKG

playball

Version:

Watch MLB games from the comfort of your terminal

31 lines (29 loc) 1.06 kB
import { get } from "./config.js"; const FAVORITES = get('favorites'); export function teamFavoriteStar(team) { const style = get('color.favorite-star') + '-fg'; if (FAVORITES.includes(team.abbreviation)) { return `{${style}}★{/${style}} `; } return ''; } /** * Get the sport ID for API calls * @returns {string} '51' for WBC, '1' for MLB */ export function getSportId() { var _process$env$PLAYBALL; // ENV override takes precedence const envSport = (_process$env$PLAYBALL = process.env.PLAYBALL_SPORT) === null || _process$env$PLAYBALL === void 0 ? void 0 : _process$env$PLAYBALL.toLowerCase(); const sport = envSport || get('sport') || 'mlb'; return sport === 'wbc' ? '51' : '1'; } /** * Get the current sport setting * @returns {string} 'mlb' or 'wbc' */ export function getSport() { var _process$env$PLAYBALL2; const envSport = (_process$env$PLAYBALL2 = process.env.PLAYBALL_SPORT) === null || _process$env$PLAYBALL2 === void 0 ? void 0 : _process$env$PLAYBALL2.toLowerCase(); return envSport || get('sport') || 'mlb'; }