3 Object.defineProperty(exports, "__esModule", {
6 exports.default = void 0;
8 var _sliceAnsi = _interopRequireDefault(require("slice-ansi"));
10 var _stringWidth = _interopRequireDefault(require("string-width"));
12 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15 * Creates an array of strings split into groups the length of size.
16 * This function works with strings that contain ASCII characters.
18 * wrapText is different from would-be "chunk" implementation
19 * in that whitespace characters that occur on a chunk size limit are trimmed.
21 * @param {string} subject
22 * @param {number} size
25 const wrapString = (subject, size) => {
27 subjectSlice = subject;
31 chunks.push((0, _sliceAnsi.default)(subjectSlice, 0, size));
32 subjectSlice = (0, _sliceAnsi.default)(subjectSlice, size).trim();
33 } while ((0, _stringWidth.default)(subjectSlice));
38 var _default = wrapString;
39 exports.default = _default;
40 //# sourceMappingURL=wrapString.js.map