3 Object.defineProperty(exports, "__esModule", {
7 var _sliceAnsi = require('slice-ansi');
9 var _sliceAnsi2 = _interopRequireDefault(_sliceAnsi);
11 var _stringWidth = require('string-width');
13 var _stringWidth2 = _interopRequireDefault(_stringWidth);
15 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18 * Creates an array of strings split into groups the length of size.
19 * This function works with strings that contain ASCII characters.
21 * wrapText is different from would-be "chunk" implementation
22 * in that whitespace characters that occur on a chunk size limit are trimmed.
24 * @param {string} subject
25 * @param {number} size
28 exports.default = (subject, size) => {
31 subjectSlice = subject;
36 chunks.push((0, _sliceAnsi2.default)(subjectSlice, 0, size));
38 subjectSlice = (0, _sliceAnsi2.default)(subjectSlice, size).trim();
39 } while ((0, _stringWidth2.default)(subjectSlice));