markdown-table-prettify
Version:
Transforms markdown tables to be more readable.
21 lines (20 loc) • 930 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.BasePadCalculator = void 0;
var BasePadCalculator = /** @class */ (function () {
function BasePadCalculator() {
}
BasePadCalculator.prototype.baseGetRightPadding = function (paddingChar, table, row, column) {
return paddingChar.repeat(this.getRightPadCount(table.getLongestColumnLengths()[column], table.rows[row].cells[column].getLength()));
};
BasePadCalculator.prototype.getRightPadCount = function (longestColumnLength, cellTextLength) {
var rightPadCount = longestColumnLength > 0
? longestColumnLength - cellTextLength
: 1;
if ((cellTextLength == 0) || (longestColumnLength > 0 && cellTextLength > 0))
rightPadCount++;
return rightPadCount;
};
return BasePadCalculator;
}());
exports.BasePadCalculator = BasePadCalculator;
;