1234567891011121314151617181920212223242526272829303132333435 |
- import wrapString from './wrapString';
- import wrapWord from './wrapWord';
- export default (cellValue, columnWidth, useWrapWord) => {
-
- const cellLines = cellValue.split('\n');
-
- for (let lineNr = 0; lineNr < cellLines.length;) {
- let lineChunks;
- if (useWrapWord) {
- lineChunks = wrapWord(cellLines[lineNr], columnWidth);
- } else {
- lineChunks = wrapString(cellLines[lineNr], columnWidth);
- }
-
- cellLines.splice(lineNr, 1, ...lineChunks);
- lineNr += lineChunks.length;
- }
- return cellLines;
- };
|