Actualizacion maquina principal
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / dist / mapDataUsingRowHeightIndex.js
1 "use strict";
2
3 Object.defineProperty(exports, "__esModule", {
4   value: true
5 });
6 exports.default = void 0;
7
8 var _flatten2 = _interopRequireDefault(require("lodash/flatten"));
9
10 var _times2 = _interopRequireDefault(require("lodash/times"));
11
12 var _wrapCell = _interopRequireDefault(require("./wrapCell"));
13
14 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
16 /**
17  * @param {Array} unmappedRows
18  * @param {number[]} rowHeightIndex
19  * @param {Object} config
20  * @returns {Array}
21  */
22 const mapDataUsingRowHeightIndex = (unmappedRows, rowHeightIndex, config) => {
23   const tableWidth = unmappedRows[0].length;
24   const mappedRows = unmappedRows.map((cells, index0) => {
25     const rowHeight = (0, _times2.default)(rowHeightIndex[index0], () => {
26       return new Array(tableWidth).fill('');
27     }); // rowHeight
28     //     [{row index within rowSaw; index2}]
29     //     [{cell index within a virtual row; index1}]
30
31     cells.forEach((value, index1) => {
32       const cellLines = (0, _wrapCell.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
33       cellLines.forEach((cellLine, index2) => {
34         rowHeight[index2][index1] = cellLine;
35       });
36     });
37     return rowHeight;
38   });
39   return (0, _flatten2.default)(mappedRows);
40 };
41
42 var _default = mapDataUsingRowHeightIndex;
43 exports.default = _default;
44 //# sourceMappingURL=mapDataUsingRowHeightIndex.js.map