1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | var _wrapString = _interopRequireDefault(require("./wrapString"));
|
9 |
|
10 | var _wrapWord = _interopRequireDefault(require("./wrapWord"));
|
11 |
|
12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | const wrapCell = (cellValue, columnWidth, useWrapWord) => {
|
26 |
|
27 | const cellLines = cellValue.split('\n');
|
28 |
|
29 | for (let lineNr = 0; lineNr < cellLines.length;) {
|
30 | let lineChunks;
|
31 |
|
32 | if (useWrapWord) {
|
33 | lineChunks = (0, _wrapWord.default)(cellLines[lineNr], columnWidth);
|
34 | } else {
|
35 | lineChunks = (0, _wrapString.default)(cellLines[lineNr], columnWidth);
|
36 | }
|
37 |
|
38 |
|
39 | cellLines.splice(lineNr, 1, ...lineChunks);
|
40 | lineNr += lineChunks.length;
|
41 | }
|
42 |
|
43 | return cellLines;
|
44 | };
|
45 |
|
46 | var _default = wrapCell;
|
47 | exports.default = _default;
|
48 |
|
\ | No newline at end of file |