@uvarovag/to-camel-case
Version:
Hard conversion of a string to camel case
12 lines (11 loc) • 378 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCamelCase = void 0;
const toCamelCase = (str) => {
return str
.toLowerCase()
.split(/[^a-zA-Zа-яА-ЯёЁ0-9]+/)
.map((word, index) => (index === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)))
.join('');
};
exports.toCamelCase = toCamelCase;