@redocly/theme
Version:
Shared UI components lib
18 lines • 655 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.changeTextCasing = changeTextCasing;
function changeTextCasing(str, casing = 'original') {
if (casing === 'original' || !str)
return str;
if (casing === 'lowercase') {
return str.toLowerCase();
}
if (casing === 'uppercase') {
return str.toUpperCase();
}
if (casing === 'sentence') {
const words = str === null || str === void 0 ? void 0 : str.split(/[\s-_]+/);
return words.map((word) => word[0].toUpperCase() + word.slice(1).toLowerCase()).join(' ');
}
}
//# sourceMappingURL=change-text-casing.js.map