Options
All
  • Public
  • Public/Protected
  • All
Menu

@01group/fxl

Index

Type aliases

Alignment: Partial<ExcelJS.Alignment>
AnyCoord: Coord | MergedCoord
Border: Partial<ExcelJS.Border>
BorderStyle: Partial<ExcelJS.BorderStyle>
Borders: Partial<ExcelJS.Borders>
CellSizes: Map<string, Map<number, number[]>>
Fill: ExcelJS.Fill
FillPattern: ExcelJS.FillPattern
FillPatterns: ExcelJS.FillPatterns
Font: Partial<ExcelJS.Font>
HorizontalAlignment: ExcelJS.Alignment["horizontal"]
MergedCoord: Coord & { height: number; width: number }
Monoid<T>: (arg: T) => T

Type parameters

  • T

Type declaration

    • (arg: T): T
    • Parameters

      • arg: T

      Returns T

Opaque<K, T>: T & { __TYPE__: K }

Type parameters

  • K

  • T

ValidCell: Opaque<"ValidCell", Cell>
Value: ExcelJS.CellValue
VerticalAlignment: ExcelJS.Alignment["vertical"]

Variables

DEFAULT_FILL: Fill = ...

Functions

  • applyIf<T>(predicate: (arg: T) => boolean, fn: Monoid<T>): Monoid<T>
  • Takes in a predicate and function. Returns a function that applies the function only when the predicate evaluates to true.

    Type parameters

    • T

    Parameters

    • predicate: (arg: T) => boolean
        • (arg: T): boolean
        • Parameters

          • arg: T

          Returns boolean

    • fn: Monoid<T>

    Returns Monoid<T>

  • applyIfElse<T>(predicate: (arg: T) => boolean, trueFn: Monoid<T>, falseFn: Monoid<T>): Monoid<T>
  • Takes in a predicate and two functions. Returns a function that applies one function when the predicate evaluates to true, otherwise applies the other function.

    Type parameters

    • T

    Parameters

    • predicate: (arg: T) => boolean
        • (arg: T): boolean
        • Parameters

          • arg: T

          Returns boolean

    • trueFn: Monoid<T>
    • falseFn: Monoid<T>

    Returns Monoid<T>

  • Takes an array of cells and returns an array of arrays of cell values.

    remarks

    The returned array of arrays has a tabular format. Missing cells are converted to undefined.

    Parameters

    Returns Value[][]

  • colToCells(values: CellValue[]): Cell[]
  • Takes an array of candidate cell values and returns a column of Cells.

    remarks

    Defaults to the first column and no styling.

    Parameters

    • values: CellValue[]

    Returns Cell[]

  • concatBelow(...cellGroups: Cell[][]): Cell[]
  • Takes in an array of groups of cells, and returns a combined group of cells where the groups are stacked vertically from top to bottom.

    Parameters

    • Rest ...cellGroups: Cell[][]

    Returns Cell[]

  • concatRight(...cellGroups: Cell[][]): Cell[]
  • Takes in an array of groups of cells, and returns a combined group of cells where the groups are stacked horizontally from left to right.

    Parameters

    • Rest ...cellGroups: Cell[][]

    Returns Cell[]

  • height(cell: Cell): number
  • lowestRow(cells: Cell[]): number
  • maxCol(cells: Cell[]): number
  • maxRow(cells: Cell[]): number
  • padAbove(numPad: number, cells: Cell[]): Cell[]
  • padBelow(numPad: number, cells: Cell[]): Cell[]
  • padLeft(numPad: number, cells: Cell[]): Cell[]
  • padRight(numPad: number, cells: Cell[]): Cell[]
  • pipe<T>(init: T, ...fns: Monoid<T>[]): T
  • recordsToCells(keys: string[], records: Record<string, CellValue>[]): Cell[]
  • Takes an array of keys and an array records containing the candidate cell values associated to the input keys. Returns a table of Cells.

    remarks

    Defaults to the first row, first column and no styling.

    example
    const table = fxl.recordsToCells(
    ['a', 'b'],
    [ { a: 1, b: 'x' }, { a: 2, b: 'y' } ]
    );

    Parameters

    • keys: string[]
    • records: Record<string, CellValue>[]

    Returns Cell[]

  • rightmostCol(cells: Cell[]): number
  • rowToCells(values: CellValue[]): Cell[]
  • Takes an array of candidate cell values and returns a row of Cells.

    remarks

    Defaults to the first row and no styling.

    Parameters

    • values: CellValue[]

    Returns Cell[]

  • setAlignment(alignment: Partial<Alignment>): Monoid<Cell>
  • setAllBorders(border: Partial<Border>): Monoid<Cell>
  • setBorder(side: "top" | "right" | "bottom" | "left", border: Partial<Border>): Monoid<Cell>
  • setBorders(borders: Partial<Borders>): Monoid<Cell>
  • Returns a new Cell with modified column width.

    remarks

    During writing, cell sizes are aggregated, and the maximum is used as the actual size. WARNING: Cell sizes are not persisted. It is not restored during reading.

    Parameters

    • colWidth: number

    Returns Monoid<Cell>

  • setHorizontalAlignement(horizontal: "right" | "left" | "center" | "fill" | "justify" | "centerContinuous" | "distributed"): Monoid<Cell>
  • Returns a new Cell with modified horizontal aligment.

    Parameters

    • horizontal: "right" | "left" | "center" | "fill" | "justify" | "centerContinuous" | "distributed"

    Returns Monoid<Cell>

  • Returns a new Cell with modified row height.

    remarks

    During writing, cell sizes are aggregated, and the maximum is used as the actual size. WARNING: Cell sizes are not persisted. It is not restored during reading.

    Parameters

    • rowHeight: number

    Returns Monoid<Cell>

  • setVerticalAlignement(vertical: "top" | "bottom" | "justify" | "distributed" | "middle"): Monoid<Cell>
  • splitErrors<T, U>(results: Result<T, U>[]): [T[], U[]]
  • Takes in an array of Result objects, and splits the Ok and Err objects as a pair of arrays.

    Type parameters

    • T

    • U

    Parameters

    • results: Result<T, U>[]

    Returns [T[], U[]]

  • tableToCells(table: CellValue[][]): Cell[]
  • Takes an array of arrays of candidate cell values, and returns a table of Cells.

    remarks

    Defaults to the first row, first column and no styling.

    Parameters

    • table: CellValue[][]

    Returns Cell[]

  • toCell(value: CellValue): Cell
  • Takes a candidate cell value and returns a fxl Cell object.

    remarks

    Defaults to the first row, first column and no styling.

    Parameters

    • value: CellValue

    Returns Cell

  • width(cell: Cell): number
  • writeBinary(cells: Cell[]): Promise<Result<ExcelJS.Buffer, Error>>
  • writeXlsx(cells: Cell[], fileName: string): Promise<Option<Error>>

Generated using TypeDoc