1 import isString from 'is-string';
2 import wrapCell from './wrapCell';
5 * @param {string} value
6 * @param {number} columnWidth
7 * @param {boolean} useWrapWord
10 export default (value, columnWidth, useWrapWord = false) => {
11 if (!isString(value)) {
12 throw new TypeError('Value must be a string.');
15 if (!Number.isInteger(columnWidth)) {
16 throw new TypeError('Column width must be an integer.');
19 if (columnWidth < 1) {
20 throw new Error('Column width must be greater than 0.');
23 return wrapCell(value, columnWidth, useWrapWord).length;