markdown-table-prettify
Version:
Transforms markdown tables to be more readable.
26 lines (25 loc) • 919 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.Cell = void 0;
var Cell = /** @class */ (function () {
function Cell(value) {
this._value = value;
}
Cell.prototype.getValue = function () {
return this._value;
};
Cell.prototype.getLength = function () {
var length = 0;
for (var i = 0, n = this._value.length; i < n; i++)
length += this.getCharDisplayLength(this._value.charAt(i));
return length;
};
Cell.prototype.getCharDisplayLength = function (character) {
// for the specified ranges use a length of 2, otherwise a length of 1
return /^(([\u{4E00}-\u{9FFF}])|([\u{3400}-\u{4DBF}])|([\u{20000}-\u{2A6DF}])|([\u{2A700}-\u{2B73F}])|([\u{2B740}-\u{2B81F}]))$/u.test(character)
? 2
: 1;
};
return Cell;
}());
exports.Cell = Cell;
;