This repository has been archived on 2022-01-16. You can view files and clone it, but cannot push or open issues or pull requests.
irreligious/node_modules/table/dist/calculateRowHeights.js

19 lines
735 B
JavaScript
Raw Normal View History

2021-09-04 22:21:14 -05:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.calculateRowHeights = void 0;
const calculateCellHeight_1 = require("./calculateCellHeight");
/**
* Produces an array of values that describe the largest value length (height) in every row.
*/
const calculateRowHeights = (rows, config) => {
return rows.map((row) => {
let rowHeight = 1;
row.forEach((cell, cellIndex) => {
const cellHeight = calculateCellHeight_1.calculateCellHeight(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord);
rowHeight = Math.max(rowHeight, cellHeight);
});
return rowHeight;
});
};
exports.calculateRowHeights = calculateRowHeights;