minimal adjustments
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / table / dist / calculateCellHeight.js.flow
1 import isString from 'is-string';
2 import wrapCell from './wrapCell';
3
4 /**
5  * @param {string} value
6  * @param {number} columnWidth
7  * @param {boolean} useWrapWord
8  * @returns {number}
9  */
10 export default (value, columnWidth, useWrapWord = false) => {
11   if (!isString(value)) {
12     throw new TypeError('Value must be a string.');
13   }
14
15   if (!Number.isInteger(columnWidth)) {
16     throw new TypeError('Column width must be an integer.');
17   }
18
19   if (columnWidth < 1) {
20     throw new Error('Column width must be greater than 0.');
21   }
22
23   return wrapCell(value, columnWidth, useWrapWord).length;
24 };