How to use the wide-align.left function in wide-align

To help you get started, we’ve selected a few wide-align examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github npm / gauge / render-template.js View on Github external
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
}
github xxhomey19 / nba-go / src / command / game / schedule.js View on Github external
const padVisitorTeamName = name => bold(left(name, TEAMNAME_WIDTH));
const padGameStatus = status => center(status, STATUS_WIDTH);
github npm / gauge / render-template.js View on Github external
var renderTemplate = module.exports = function (width, template, values) {
  var items = prepareItems(width, template, values)
  var rendered = items.map(renderValueWithValues(values)).join('')
  return align.left(wideTruncate(rendered, width), width)
}
github xxhomey19 / nba-go / src / command / game / schedule.js View on Github external
const padAwayTeamNetwork = network => bold(left(network, NETWORK_WIDTH));
github GoogleContainerTools / kpt / docsy / node_modules / fsevents / node_modules / gauge / render-template.js View on Github external
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
}
github xxhomey19 / nba-go / src / command / game / live.js View on Github external
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
    )} ${eventDescription.replace(/\[.*\]/i, '')}\n`;

    playByPlayRows.push([time, scoreboard, description].join(' │ '));
  }

  return playByPlayRows.join('\n');
};
github GoogleContainerTools / kpt / docsy / node_modules / fsevents / node_modules / gauge / render-template.js View on Github external
var renderTemplate = module.exports = function (width, template, values) {
  var items = prepareItems(width, template, values)
  var rendered = items.map(renderValueWithValues(values)).join('')
  return align.left(wideTruncate(rendered, width), width)
}
github xxhomey19 / nba-go / src / command / game / live.js View on Github external
mainPlayers.forEach(player => {
    teamBoxscoreRows.push([
      bold(left(player.last_name, 14)),
      left(checkOverStandard(player.points, 20), 3),
      left(checkOverStandard(player.assists, 10), 3),
      left(
        `${checkOverStandard(
          +player.rebounds_offensive + +player.rebounds_defensive,
          10
        )}`,
        3
      ),
    ]);
  });

wide-align

A wide-character aware text alignment function for use on the console or with fixed width fonts.

ISC
Latest version published 3 years ago

Package Health Score

65 / 100
Full package analysis