blob: 6f66ee2495441bc0673d2d26eddebc1e62559ce4 [file] [edit]
/**
* @param {string} str
* @returns {string}
*/
const toCamelCase = (str) => {
return str.toLowerCase().replaceAll(/^[a-z]/gv, (init) => {
return init.toUpperCase();
}).replaceAll(/_(?<wordInit>[a-z])/gv, (_, n1, o, s, {wordInit}) => {
return wordInit.toUpperCase();
});
};
export {toCamelCase};