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 * @param {string} input
16 * @param {number} size
19 const wrapWord = (input, size) => {
22 const chunks = []; // https://regex101.com/r/gY5kZ1/1
24 const re = new RegExp('(^.{1,' + size + '}(\\s+|$))|(^.{1,' + (size - 1) + '}(\\\\|/|_|\\.|,|;|-))');
28 chunk = subject.match(re);
32 subject = (0, _sliceAnsi.default)(subject, (0, _stringWidth.default)(chunk));
35 chunk = (0, _sliceAnsi.default)(subject, 0, size);
36 subject = (0, _sliceAnsi.default)(subject, size);
40 } while ((0, _stringWidth.default)(subject));
45 var _default = wrapWord;
46 exports.default = _default;
47 //# sourceMappingURL=wrapWord.js.map