MCPcopy Create free account
hub / github.com/cli-table/cli-table3 / init

Method init

src/cell.js:111–123  ·  view source on GitHub ↗

* Initializes the Cells data structure. * * @param tableOptions - A fully populated set of tableOptions. * In addition to the standard default values, tableOptions must have fully populated the * `colWidths` and `rowWidths` arrays. Those arrays must have lengths equal to the number *

(tableOptions)

Source from the content-addressed store, hash-verified

109 *
110 */
111 init(tableOptions) {
112 let x = this.x;
113 let y = this.y;
114 this.widths = tableOptions.colWidths.slice(x, x + this.colSpan);
115 this.heights = tableOptions.rowHeights.slice(y, y + this.rowSpan);
116 this.width = this.widths.reduce(sumPlusOne, -1);
117 this.height = this.heights.reduce(sumPlusOne, -1);
118
119 this.hAlign = this.options.hAlign || tableOptions.colAligns[x];
120 this.vAlign = this.options.vAlign || tableOptions.rowAligns[y];
121
122 this.drawRight = x + this.colSpan == tableOptions.colWidths.length;
123 }
124
125 /**
126 * Draws the given line of the cell.

Callers 2

cell-test.jsFile · 0.45
toStringMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected