Matrix-Chat-Message/node_modules/table/dist/calculateCellWidthIndex.js.flow
Tristan Helmich (omniIT) d4829ad0cc ESLint setup
2020-10-05 17:36:56 +00:00

18 lines
328 B
Plaintext

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);
})
);
});
};