react-markdown-table-ts 0.3.7 → 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.esm.js CHANGED
@@ -4103,7 +4103,7 @@ function calculateColumnWidths(inputDataRows, maxColumnCount, minWidth) {
4103
4103
  * @returns The Markdown string for the row.
4104
4104
  */
4105
4105
  function formatMarkdownRow(columnCount, currentRow, columnAlignments, columnWidths, useTabs, canReplaceNewlines) {
4106
- var _a, _b;
4106
+ var _a, _b, _c;
4107
4107
  if (useTabs === void 0) { useTabs = false; }
4108
4108
  if (canReplaceNewlines === void 0) { canReplaceNewlines = false; }
4109
4109
  var defaultAlignment = 'left';
@@ -4112,14 +4112,10 @@ function formatMarkdownRow(columnCount, currentRow, columnAlignments, columnWidt
4112
4112
  var markdownRow = '|';
4113
4113
  for (var i = 0; i < columnCount; i++) {
4114
4114
  var cell = (_a = currentRow[i]) !== null && _a !== void 0 ? _a : '';
4115
- if (canReplaceNewlines) {
4116
- cell = cell.replace(/\n/g, '<br>');
4117
- }
4118
- else {
4119
- cell = cell.replace(/\n/g, ' ');
4120
- }
4121
4115
  var alignment = (_b = adjustedAlignments[i]) !== null && _b !== void 0 ? _b : defaultAlignment;
4122
- var targetWidth = columnWidths ? columnWidths[i] : cell.length;
4116
+ cell = "".concat(canReplaceNewlines ? cell.replace(/\n/g, '<br>') : cell.replace(/\n/g, ' '));
4117
+ // Safe access to columnWidths with fallback
4118
+ var targetWidth = (_c = columnWidths === null || columnWidths === void 0 ? void 0 : columnWidths[i]) !== null && _c !== void 0 ? _c : cell.length;
4123
4119
  if (alignment === 'right') {
4124
4120
  markdownRow += "".concat(cell.padStart(targetWidth)).concat(useTabs ? '\t' : '', "|");
4125
4121
  }