/ cloudformation-templates / node_modules / table / dist / src / calculateColumnWidths.js
calculateColumnWidths.js
 1  "use strict";
 2  Object.defineProperty(exports, "__esModule", { value: true });
 3  const calculateCellWidths_1 = require("./calculateCellWidths");
 4  /**
 5   * Produces an array of values that describe the largest value length (width) in every column.
 6   */
 7  exports.default = (rows) => {
 8      const columnWidths = new Array(rows[0].length).fill(0);
 9      rows.forEach((row) => {
10          const cellWidths = (0, calculateCellWidths_1.calculateCellWidths)(row);
11          cellWidths.forEach((cellWidth, cellIndex) => {
12              columnWidths[cellIndex] = Math.max(columnWidths[cellIndex], cellWidth);
13          });
14      });
15      return columnWidths;
16  };
17  //# sourceMappingURL=calculateColumnWidths.js.map