mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-12-11 08:24:31 +01:00
17 lines
329 B
Text
17 lines
329 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);
|
|
}),
|
|
);
|
|
});
|
|
};
|