Class Table<T>

Two-dimensional table class supporting column and row headers.

Type Parameters

  • T

    The type of the data in the table.

Hierarchy

  • Table

Constructors

  • Creates a new Table.

    Type Parameters

    • T

    Parameters

    • data: T[][]

      The data of the table.

    • Optional headers: string[]

      The headers of the table.

    Returns Table<T>

Properties

_colIndexMap: Record<string, number> = {}

Map from column names to column indices.

_data: T[][] = []

The data of the table.

_headers: string[]

The headers of the table.

Accessors

Methods

  • Returns a value at a given (row, col) position.

    Parameters

    • column: string | number

      Column index or name

    • row: number

      Row index

    Returns T

  • Inserts a given value at a given (row, col) position.

    Parameters

    • column: string | number

      Column index

    • row: number

      Row index

    • value: T

      The value to insert

    Returns Table<T>

  • Returns the table as a two-dimensional array, including row and column headers..

    Returns (string | T)[][]

Generated using TypeDoc