JAVASCRIPT
Converting Kebab-Case Strings to CamelCase
Transform kebab-case strings (e.g., 'my-component') into camelCase (e.g., 'myComponent') using a concise JavaScript regular expression.
const kebabCaseString = "my-awesome-component-name";
const camelCaseString = kebabCaseString.replace(/-(\w)/g, (match, p1) => p1.toUpperCase());
console.log(camelCaseString); // Output: "myAwesomeComponentName"
How it works: This snippet utilizes `String.prototype.replace()` with a regex `/-(\w)/g`. It finds a hyphen followed by any word character (`\w`). The matched word character is captured in a group (accessible as `p1` in the replacer function). The replacer function then converts `p1` to uppercase, effectively removing the hyphen and capitalizing the subsequent letter, thus transforming kebab-case to camelCase.