INNER CODE UNIT · JavaScript

UsageFormatter

puppeteer/examples · code_coverage.js:51

class UsageFormatter {
  constructor(stats) {
    this.stats = stats;
  }

  static eventLabel(event) {
    // const maxEventLabelLen = EVENTS.reduce((currMax, event) => Math.max(currMax, event.length), 0);
    // const eventLabel = event + ' '.repeat(maxEventLabelLen - event.length);
    return chalk.magenta(event);
  }

  summary(used = this.stats.usedBytes, total = this.stats.totalBytes) {
    const percent = Math.round((used / total) * 100);
    return `${formatBytesToKB(used)}/${formatBytesToKB(total)} (${percent}%)`;
  }

  shortSummary(used, total = this.stats.totalBytes) {
    const percent = Math.round((used / total) * 100);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…