Type alias FormatTableOptions

FormatTableOptions: {
    alignment?: string;
    colors?: boolean | Partial<Readonly<Colors>>;
    columnBorders?: boolean;
    formatCell?: ((cell) => string);
    header?: ReadonlyArray<unknown>;
    headerAlignment?: string;
    outline?: boolean;
    raw?: boolean;
    rowBorders?: boolean;
    style?: Partial<Readonly<TableStyle>>;
    tabWidth?: number;
}

Type declaration

  • Optional Readonly alignment?: string

    Alignment of columns.

    Alignments:

    • > ... left aligned (default unless specified otherwise)
    • < ... right aligned (default for boolean)
    • - ... centered (default for headers unless specified otherwise)
    • . ... right aligned on the . (default for number, bigint, and Date)
    • ... use default (useful if you want to override the default of a later column, but not of an earlier one)
  • Optional Readonly colors?: boolean | Partial<Readonly<Colors>>

    Print with ANSI escape sequences for colors.

    If not specified it tries to auto-detect via navigator.userAgent.includes("Chrome") or process.stdout.isTTY.

  • Optional Readonly columnBorders?: boolean

    Print vertical borders between columns. (default: false)

    If false there will still be a double space between columns, just not the visible border.

  • Optional Readonly formatCell?: ((cell) => string)
      • (cell): string
      • Format function to be called on non-string cells.

        Per default objects are formatted using JSON.stringify(cell, ..., tabWidth), functions as `[Function: ${name}]`, dates via cell.toISOString(), and everything else just as String(cell).

        Parameters

        • cell: unknown

        Returns string

        formatted cell

  • Optional Readonly header?: ReadonlyArray<unknown>

    Array of titles printed in an extra header row.

  • Optional Readonly headerAlignment?: string

    Alignment of header columns. If not specified defaults to same as alignment.

  • Optional Readonly outline?: boolean

    Print outline around the table. (default: true)

  • Optional Readonly raw?: boolean

    Print raw cell values, i.e. don't escape ANSI escape sequences in the provided string cells.

  • Optional Readonly rowBorders?: boolean

    Print horizontal borders between rows. (default: false)

    There is always a border between the header row and the rest. If this option is used that border will be printed as a double-line or fatter, depending on the used style.

  • Optional Readonly Interface style?: Partial<Readonly<TableStyle>>

    Override style properties. (default: DefaultTableStyle)

    See

    TableStyle

  • Optional Readonly tabWidth?: number

    Width of a tab in string cells or of the indendation used with JSON.stringify().

Generated using TypeDoc