@rws-air/utils
Version:
Utilities for rws-air libraries and applications
17 lines • 680 B
JavaScript
;
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