How to use the table.getBorderCharacters function in table

To help you get started, we’ve selected a few table 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 hyperledger / caliper / packages / caliper-core / lib / master / report / report.js View on Github external
printTable(tableArray) {
        // tableArray[0] = array of column titles
        // tableArray[1+] = array column values
        let t = table.table(tableArray, {border: table.getBorderCharacters('ramac')});
        Logger.info('\n' + t);
    }
github wildbit / postmark-cli / src / commands / templates / push.ts View on Github external
layouts.length > 0
      ? `${layouts.length} ${pluralize(layouts.length, 'layout', 'layouts')}`
      : ''

  // Log template and layout files
  if (templates.length > 0) {
    log(`\n${templatesLabel}`)
    log(
      table([templatesHeader, ...templates], {
        border: getBorderCharacters('norc'),
      })
    )
  }
  if (layouts.length > 0) {
    log(`\n${layoutsLabel}`)
    log(table([header, ...layouts], { border: getBorderCharacters('norc') }))
  }

  // Log summary
  log(
    chalk.yellow(
      `${templatesLabel}${
        templates.length > 0 && layouts.length > 0 ? ' and ' : ''
      }${layoutsLabel} will be pushed to Postmark.`
    )
  )
}
github quicktype / autotune / src / cli / index.ts View on Github external
function logTable(rows: any[], style: "void" | "norc" = "norc") {
    rows = removeWhitespace(rows);
    console.log(
        table(rows, {
            border: getBorderCharacters(style),
            columnDefault: {
                truncate: 80
            }
        })
    );
}
github mcollina / autocannon-ci / autocannon-ci.js View on Github external
console.log(`The two jobs throughput is statistically ${chalk.bold('equal')}`)
  } else {
    console.log(`The two jobs throughput is ${chalk.bold('not')} statistically ${chalk.bold('equal')}`)
  }

  console.log('')

  columns.unshift('Stat')

  const out = table.table([
    columns.map(k => chalk.cyan(k)),
    row('req/s', results, keys, 'requests', chalk.green, chalk.red),
    row('throughput', results, keys, 'throughput', chalk.green, chalk.red),
    row('latency', results, keys, 'latency', chalk.red, chalk.green)
  ], {
    border: table.getBorderCharacters('void'),
    columnDefault: {
      paddingLeft: 0,
      paddingRight: 1
    },
    drawHorizontalLine: () => false
  })

  console.log(out)
}
github coderaiser / putout / packages / formatter-dump / lib / dump.js View on Github external
});
    
    if (!json)
        return '';
    
    if (!json.errors.length)
        return '';
    
    const output = [];
    for (const {name, places} of json.errors) {
        const line = buildLine(places);
        
        output.push([
            underline(name),
            table(line, {
                border: getBorderCharacters('void'),
                drawHorizontalLine: () => false,
            }),
        ].join('\n'));
    }
    
    output.push(bold(redBright(`✖ ${errorsCount} errors in ${filesCount} files`)));
    output.push(bold(redBright('  fixable with the `--fix` option')));
    
    return output.join('\n') + '\n';
};
github hyperledger / caliper / src / comm / monitor / monitor.js View on Github external
let historyItems = this._getMaxItems();
            tableHead.push.apply(tableHead, historyItems);

            defaultTable.push(tableHead);
            for(let i in this.peers){
                let row = [];
                for(let j in this.peers[i].info) {
                    row.push(strNormalize(this.peers[i].info[j]));
                }

                let historyValues = this._getMaxHistoryValues(historyItems, i);
                row.push.apply(row, historyValues);
                defaultTable.push(row);
            }

            let t = table.table(defaultTable, {border: table.getBorderCharacters('ramac')});
            logger.info('\n ### resource stats (maximum) ###');
            logger.info('\n' + t);
        }
        catch(err) {
            logger.error('Failed to read monitoring data, ' + (err.stack ? err.stack : err));
        }
    }
github hyperledger / caliper / src / comm / bench-flow.js View on Github external
function printTable(value) {
    let t = table.table(value, {border: table.getBorderCharacters('ramac')});
    logger.info('\n' + t);
}
github coderaiser / putout / packages / formatter-stream / lib / stream.js View on Github external
line,
            column,
        } = position;
        
        data.push([
            grey(`${line}:${column}`),
            `${red('error')}   ${message}`,
            grey(rule),
        ]);
    }
    
    if (data.length)
        output.push([
            underline(name),
            table(data, {
                border: getBorderCharacters('void'),
                drawHorizontalLine: () => false,
            }),
        ].join('\n'));
    
    if (!output.length)
        return '';
    
    if (index === count - 1) {
        const result = [
            count === 1 ? output : '',
            bold(redBright(`✖ ${errorsCount} errors in ${filesCount} files`)),
            bold(redBright('  fixable with the `--fix` option')),
        ].filter(Boolean);
        
        return result.join('\n') + '\n';
    }
github coderaiser / putout / bin / putout.js View on Github external
column,
        } = getPosition(loc);
        
        ++errorsCount;
        
        const msg = rendy(message, place);
        data.push([
            grey(`${line}:${column}`),
            `${red('error')}   ${msg}`,
        ]);
    }
    
    return [
        underline(resolve(name)),
        table(data, {
            border: getBorderCharacters('void'),
            drawHorizontalLine: () => false,
        })
    ].join('\n');
}