mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-26 01:16:56 +01:00
1ada95e04a
- Convert project to Javascript/Typescript - Allow custom headers to be passed in (optional) - Allow body to be optional
17 lines
328 B
Text
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);
|
|
})
|
|
);
|
|
});
|
|
};
|