@drivy/cobalt
Version:
Opinionated design system for Drivy's projects.
14 lines (12 loc) • 407 B
JavaScript
function camelize(s) {
return s
.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
if (+match === 0)
return ""; // or if (/\s+/.test(match)) for white spaces
return index === 0 ? match.toLowerCase() : match.toUpperCase();
})
.replace(/-/g, "")
.replace(/_/g, "");
}
export { camelize as default };
//# sourceMappingURL=camelize.js.map