react-markdown-table-ts 0.5.12 → 0.5.13

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
@@ -18537,21 +18537,28 @@ var Tooltip$1 = Tooltip;
18537
18537
  // CSS styles
18538
18538
  var LIGHT_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#000;background:0 0;text-shadow:0 1px #fff;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}code[class*=language-] ::-moz-selection,code[class*=language-]::-moz-selection,pre[class*=language-] ::-moz-selection,pre[class*=language-]::-moz-selection{text-shadow:none;background:#b3d4fc}code[class*=language-] ::selection,code[class*=language-]::selection,pre[class*=language-] ::selection,pre[class*=language-]::selection{text-shadow:none;background:#b3d4fc}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*=language-],pre[class*=language-]{background:#f5f2f0}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
18539
18539
  var DARK_THEME_CSS = "\ncode[class*=language-],pre[class*=language-]{color:#f8f8f2;background:0 0;text-shadow:0 1px rgba(0,0,0,.3);font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border-radius:.3em}:not(pre)>code[class*=language-],pre[class*=language-]{background:#282a36}:not(pre)>code[class*=language-]{padding:.1em;border-radius:.3em;white-space:normal}pre[class*=language-].line-numbers{position:relative;padding-left:2.4em;counter-reset:linenumber}pre[class*=language-].line-numbers>code{position:relative;white-space:inherit}.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:0;font-size:100%;left:-3.8em;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.line-numbers-rows>span{display:block;counter-increment:linenumber}.line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.5em;text-align:right}\n";
18540
- var generateTableSyntax = function (inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding) {
18541
- if (inputData === null) {
18542
- return 'Error: No data provided for the table.';
18540
+ var validateInputData = function (inputData) {
18541
+ if (inputData === null || !Array.isArray(inputData) || inputData.length === 0) {
18542
+ throw new MarkdownTableError("The 'data' prop must be a non-empty two-dimensional array.");
18543
18543
  }
18544
+ };
18545
+ var getTableData = function (inputData, hasHeader) {
18546
+ return hasHeader
18547
+ ? { inputDataHeader: inputData[0], inputDataBody: inputData.slice(1) }
18548
+ : { inputDataHeader: generateAlphabetHeaders(inputData[0].length), inputDataBody: inputData };
18549
+ };
18550
+ var generateTableSyntax = function (inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding) {
18544
18551
  try {
18545
- if (!Array.isArray(inputData) || inputData.length === 0) {
18546
- throw new MarkdownTableError("The 'data' prop must be a non-empty two-dimensional array.");
18547
- }
18548
- var _a = hasHeader
18549
- ? { inputDataHeader: inputData[0], inputDataBody: inputData.slice(1) }
18550
- : { inputDataHeader: generateAlphabetHeaders(inputData[0].length), inputDataBody: inputData }, inputDataHeader = _a.inputDataHeader, inputDataBody = _a.inputDataBody;
18552
+ validateInputData(inputData);
18553
+ var nonNullInputData = inputData;
18554
+ var _a = getTableData(nonNullInputData, hasHeader), inputDataHeader = _a.inputDataHeader, inputDataBody = _a.inputDataBody;
18551
18555
  return generateMarkdownTableString({ inputDataHeader: inputDataHeader, inputDataBody: inputDataBody }, columnAlignments, adjustColumnWidths, hasTabs, canReplaceNewlines, hasPadding);
18552
18556
  }
18553
18557
  catch (error) {
18554
- return error instanceof MarkdownTableError ? "Error: ".concat(error.message) : (function () { throw error; })();
18558
+ if (error instanceof MarkdownTableError) {
18559
+ return "Error: ".concat(error.message);
18560
+ }
18561
+ throw error;
18555
18562
  }
18556
18563
  };
18557
18564
  var applySyntaxHighlighting = function (preElementRef, markdownTableSyntax) {