webhook/node_modules/table/dist/calculateCellWidthIndex.js.flow
2020-08-26 09:57:08 +10:00

17 lines
328 B
Text

import stringWidth from 'string-width';
/**
* Calculates width of each cell contents.
*
* @param {string[]} cells
* @returns {number[]}
*/
export default (cells) => {
return cells.map((value) => {
return Math.max(
...value.split('\n').map((line) => {
return stringWidth(line);
})
);
});
};