UNPKG

@rws-air/utils

Version:
17 lines 680 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createWrappableText = void 0; /** * Inserts a space in any text after every maxLength amount of characters, allowing Material-UI to gracefully wrap it * @param text text to split * @param maxLength The maximum length of a text section @default 75 */ function createWrappableText(text, maxLength = 75) { const splitRegex = new RegExp(`.{1,${maxLength}}`, 'g'); const splitContent = text.match(splitRegex); if (splitContent) return splitContent.join(' '); return text; } exports.createWrappableText = createWrappableText; //# sourceMappingURL=CreateWrappableText.js.map