markdown-table-prettify
Version:
Transforms markdown tables to be more readable.
26 lines (25 loc) • 955 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.AlignmentFactory = void 0;
var alignment_1 = require("../models/alignment");
var AlignmentFactory = /** @class */ (function () {
function AlignmentFactory() {
}
AlignmentFactory.prototype.createAlignments = function (cells) {
var _this = this;
return cells.map(function (cell) { return _this.alignmentOf(cell.trim()); });
};
AlignmentFactory.prototype.alignmentOf = function (cell) {
var left = cell[0] == ":";
var right = cell[cell.length - 1] == ":";
if (left && right)
return alignment_1.Alignment.Center;
if (right)
return alignment_1.Alignment.Right;
if (left)
return alignment_1.Alignment.Left;
return alignment_1.Alignment.NotSet;
};
return AlignmentFactory;
}());
exports.AlignmentFactory = AlignmentFactory;
;