• Version 0.0.32
  • Published
  • 8.14 kB
  • No dependencies
  • MIT license


npm i @types/easy-table
yarn add @types/easy-table
pnpm add @types/easy-table


TypeScript definitions for easy-table



class EasyTable

class EasyTable {}


    public constructor();

      property aggr

      static aggr: Aggregators;
      • Predefined helpers for totals

      property padLeft

      static padLeft: CellPrinter<string>;

        property separator

        separator: string;
        • String to separate columns

        method cell

        cell: <T>(col: string, val: T, printer?: CellPrinter<T>) => this;
        • Write cell in the current row

          Parameter col

          Column name

          Parameter val

          Cell value

          Parameter printer

          Printer function to format the value


          {Table} this

        method columns

        columns: () => string[];
        • Get list of columns in printing order



        method forEachTotal

        forEachTotal: <T>(
        cb: (column: string, value: T, printer: CellPrinter<T>) => void
        ) => void;
        • Compute all totals and yield the results to cb

          Parameter cb

          Callback function with signature (column, value, printer)

        method leftPadder

        static leftPadder: <T>(ch: string) => CellPrinter<T>;
        • Create a printer which right aligns the content by padding with ch on the left

          Parameter ch



        method log

        static log: <T>(
        obj: T | T[],
        format?: FormatFunction<T> | FormatObject,
        cb?: TablePostProcessing
        ) => void;
        • Same as Table.print() but yields the result to console.log()

        • Same as .toString() but yields the result to console.log()

        method newRow

        newRow: () => this;
        • Push the current row to the table and start a new one


          {Table} this

        method number

        static number: (digits?: number) => CellPrinter<number>;
        • Create a printer for numbers

          Will do right alignment and optionally fix the number of digits after decimal point

          Parameter digits

          Number of digits for fixpoint notation



        method print

        static print: <T>(
        obj: T | T[],
        format?: FormatFunction<T> | FormatObject,
        cb?: TablePostProcessing
        ) => string;
        • Format just rows, i.e. print the table without headers and totals


          {String} String representaion of the table

        • Print the array or object

          Parameter obj

          Object to print

          Parameter format

          Format options

          Parameter cb

          Table post processing and formating



        method printTransposed

        printTransposed: <T>(opts?: PrintColumnOptions<T>) => string;
        • Format the table so that each row represents column and each column represents row

          Parameter opts



        method pushDelimeter

        pushDelimeter: (cols?: ReadonlyArray<string>) => this;
        • Push delimeter row to the table (with each cell filled with dashs during printing)

          Parameter cols


          {Table} this

        method rightPadder

        static rightPadder: <T>(ch: string) => CellPrinter<T>;
        • Create a printer which pads with ch on the right

          Parameter ch



        method sort

        sort: {
        (cmp?: ReadonlyArray<string>): this;
        <T>(cmp?: CompareFunction<T>): this;
        • Sort the table

          Parameter cmp

          Either compare function or a list of columns to sort on


          {Table} this

        method string

        static string: (value: any) => string;
        • Default printer

        method toString

        toString: () => string;
        • Format the table



        method total

        total: <T>(col: string, opts?: TotalOptions<T>) => this;
        • Add a total for the column

          Parameter col

          column name

          Parameter opts


          {Table} this

        Package Files (1)

        Dependencies (0)

        No dependencies.

        Dev Dependencies (0)

        No dev dependencies.

        Peer Dependencies (0)

        No peer dependencies.


        To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

        You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/easy-table.

        • Markdown
        • HTML
          <a href="https://www.jsdocs.io/package/@types/easy-table"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>