Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const padHomeTeamNetwork = network => bold(right(network, NETWORK_WIDTH));
const padAwayTeamNetwork = network => bold(left(network, NETWORK_WIDTH));
? homeTeam.getWinnerName('left')
: homeTeam.getName({ color: true })
);
const visitorTeamName = padVisitorTeamName(
winner === 'visitor'
? visitorTeam.getWinnerName('right')
: visitorTeam.getName({ color: true })
);
const match = `${homeTeamName}${center(
emoji.get('basketball'),
8
)}${visitorTeamName}`;
const homeTeamScore =
winner === 'home'
? right(bold(neonGreen(homeTeam.getScore())), 4)
: right(bold(homeTeam.getScore()), 4);
const visitorTeamScore =
winner === 'visitor'
? left(bold(neonGreen(visitorTeam.getScore())), 4)
: left(bold(visitorTeam.getScore()), 4);
const score = `${homeTeamScore} : ${visitorTeamScore}`;
if (broadcasters) {
const networks = getBroadcastNetworks(broadcasters.tv.broadcaster);
const networksOutput = `${padHomeTeamNetwork(
networks.homeTeam
)} ${emoji.get('tv')} ${padAwayTeamNetwork(networks.visitorTeam)}|`;
return `│⌘${match}│${score}│${padGameStatus(
`${bold(periodStatus)} ${gameClock}`
)}│${networksOutput}`;
}
return `│⌘${match}│${score}│${padGameStatus(
const padHomeTeamName = name => bold(right(name, TEAMNAME_WIDTH));
const padVisitorTeamName = name => bold(left(name, TEAMNAME_WIDTH));
function renderValue (item, values) {
var length = item.getBaseLength()
var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value
if (value == null || value === '') return ''
var alignWith = align[item.align] || align.left
var leftPadding = item.padLeft ? align.left('', item.padLeft) : ''
var rightPadding = item.padRight ? align.right('', item.padRight) : ''
var truncated = wideTruncate(String(value), length)
var aligned = alignWith(truncated, length)
return leftPadding + aligned + rightPadding
}
for (let i = 0; i < allPlays.length; i += 1) {
const {
clock,
period,
description: eventDescription,
home_score,
visitor_score,
team_abr,
} = allPlays[i];
const overtimePeriod = getOvertimePeriod(period);
const time = `${+overtimePeriod > 1 ? 'OT' : 'Q'}${
+overtimePeriod > 1 ? overtimePeriod : period
} ${clock !== '' ? clock : '12:00'}`;
const scoreboard = `${right(
home_score > R.prop('home_score', allPlays[i + 1])
? bold(neonGreen(home_score))
: bold(home_score),
3
)} - ${left(
visitor_score > R.prop('visitor_score', allPlays[i + 1])
? bold(neonGreen(visitor_score))
: bold(visitor_score),
3
)}`;
const teamColor = getMainColor(team_abr)
? getMainColor(team_abr).hex
: '#000';
const description = `${left(
colorTeamName(teamColor, `${team_abr}`),
3
function renderValue (item, values) {
var length = item.getBaseLength()
var value = typeof item.value === 'function' ? renderFunction(item, values, length) : item.value
if (value == null || value === '') return ''
var alignWith = align[item.align] || align.left
var leftPadding = item.padLeft ? align.left('', item.padLeft) : ''
var rightPadding = item.padRight ? align.right('', item.padRight) : ''
var truncated = wideTruncate(String(value), length)
var aligned = alignWith(truncated, length)
return leftPadding + aligned + rightPadding
}