react-markdown-table-ts 0.3.8 → 0.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +4 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +4 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -4111,7 +4111,7 @@ function calculateColumnWidths(inputDataRows, maxColumnCount, minWidth) {
|
|
4111
4111
|
* @returns The Markdown string for the row.
|
4112
4112
|
*/
|
4113
4113
|
function formatMarkdownRow(columnCount, currentRow, columnAlignments, columnWidths, useTabs, canReplaceNewlines) {
|
4114
|
-
var _a, _b;
|
4114
|
+
var _a, _b, _c;
|
4115
4115
|
if (useTabs === void 0) { useTabs = false; }
|
4116
4116
|
if (canReplaceNewlines === void 0) { canReplaceNewlines = false; }
|
4117
4117
|
var defaultAlignment = 'left';
|
@@ -4120,16 +4120,11 @@ function formatMarkdownRow(columnCount, currentRow, columnAlignments, columnWidt
|
|
4120
4120
|
var markdownRow = '|';
|
4121
4121
|
for (var i = 0; i < columnCount; i++) {
|
4122
4122
|
var cell = (_a = currentRow[i]) !== null && _a !== void 0 ? _a : '';
|
4123
|
-
if (canReplaceNewlines) {
|
4124
|
-
cell = cell.replace(/\n/g, '<br>');
|
4125
|
-
}
|
4126
|
-
else {
|
4127
|
-
cell = cell.replace(/\n/g, ' ');
|
4128
|
-
}
|
4129
4123
|
var alignment = (_b = adjustedAlignments[i]) !== null && _b !== void 0 ? _b : defaultAlignment;
|
4130
|
-
|
4124
|
+
cell = "".concat(canReplaceNewlines ? cell.replace(/\n/g, '<br>') : cell.replace(/\n/g, ' '));
|
4125
|
+
// Safe access to columnWidths with fallback
|
4126
|
+
var targetWidth = (_c = columnWidths === null || columnWidths === void 0 ? void 0 : columnWidths[i]) !== null && _c !== void 0 ? _c : cell.length;
|
4131
4127
|
if (alignment === 'right') {
|
4132
|
-
cell = "".concat(canReplaceNewlines ? cell.replace(/\n/g, '<br>') : cell.replace(/\n/g, ' '));
|
4133
4128
|
markdownRow += "".concat(cell.padStart(targetWidth)).concat(useTabs ? '\t' : '', "|");
|
4134
4129
|
}
|
4135
4130
|
else if (alignment === 'center') {
|