@es-joy/jsdoccomment
Version:
Maintained replacement for ESLint's deprecated SourceCode#getJSDocComment along with other jsdoc utilities
14 lines (12 loc) • 315 B
JavaScript
/**
* @param {string} str
* @returns {string}
*/
const toCamelCase = (str) => {
return str.toLowerCase().replaceAll(/^[a-z]/gu, (init) => {
return init.toUpperCase();
}).replaceAll(/_(?<wordInit>[a-z])/gu, (_, n1, o, s, {wordInit}) => {
return wordInit.toUpperCase();
});
};
export {toCamelCase};