github-pages-deploy-action/node_modules/table/dist/calculateCellWidthIndex.js.flow

18 lines
328 B
Plaintext
Raw Normal View History

2020-03-07 11:45:40 +08:00
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);
})
);
});
};