"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Row = void 0; class Row { /** * Create a new Row to be inserted into a table * @param {RowData} options */ constructor(options) { this.columns = options.columns; this.indexes = options.indexes; this.whiteSpace = options.whiteSpace; } /** * Convert the row into a string * @returns {string} */ toString() { let res = ''; for (let i = 0; i < this.columns.length; i++) { res += this.padRow(i); } return res; } /** * Adds the proper spacing to the data in the row * @param {number} i * @returns {string} */ padRow(i) { return `${this.whiteSpace ? '\u200b ' : ' '}`.repeat(this.indexes[i] - (this.indexes[i - 1] ?? 0) - (this.columns[i - 1] ? (this.columns[i - 1] + '').length : 0)) + this.columns[i].slice(0, (this.indexes[i + 1] ?? Infinity) - this.indexes[i]); } } exports.Row = Row; //# sourceMappingURL=Row.js.map