How to use the table.default 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 kriskowal / kni / kni.js View on Github external
if (i === keys.length - 1) {
            next = null;
        } else {
            next = keys[i + 1];
        }
        cells.push([
            stripe(i, node.position),
            stripe(i, key),
            stripe(i, node.mode || node.type),
            stripe(i, node.lift ? '-' : ' '),
            stripe(i, describe(node)),
            stripe(i, node.drop ? '-' : ' '),
            stripe(i, describeNext(node.next, next))
        ]);
    }
    console.log(table(cells, {
        border: getBorderCharacters('void'),
        columnDefault: {
            paddingLeft: 0,
            paddingRight: 2
        },
        columns: {
            4: {
                width: 40,
                wrapWord: true
            }
        },
        drawHorizontalLine: no
    }));
}
github zerothstack / zeroth / src / server / services / remoteCli.service.ts View on Github external
public makeTable(data: any[][], config?: TableConfig): string {
    return table(data, config);
  }
github textlint / textlint / packages / @textlint / linter-formatter / src / formatters / table.ts View on Github external
chalk.bold("Rule ID")
    ]);

    messages.forEach(function(message: TextlintMessage) {
        let messageType;

        if ((message as any).fatal || message.severity === 2) {
            messageType = chalk.red("error");
        } else {
            messageType = chalk.yellow("warning");
        }

        rows.push([message.line || 0, message.column || 0, messageType, message.message, message.ruleId || ""]);
    });

    return table(rows, {
        columns: {
            0: {
                width: 8,
                wrapWord: true
            },
            1: {
                width: 8,
                wrapWord: true
            },
            2: {
                width: 8,
                wrapWord: true
            },
            3: {
                paddingRight: 5,
                width: 50,
github textlint / textlint / packages / @textlint / linter-formatter / src / formatters / table.ts View on Github external
let result = "";
    let errorCount = 0;
    let warningCount = 0;

    report.forEach(function(fileReport: any) {
        errorCount += fileReport.errorCount;
        warningCount += fileReport.warningCount;
    });

    if (errorCount || warningCount) {
        result = drawReport(report);
    }

    result +=
        "\n" +
        table(
            [
                [chalk.red(pluralize("Error", errorCount, true))],
                [chalk.yellow(pluralize("Warning", warningCount, true))]
            ],
            {
                columns: {
                    0: {
                        width: 110,
                        wrapWord: true
                    }
                },
                drawHorizontalLine: function() {
                    return true;
                }
            }
        );