2 * Convert a kebab-case string to camelCase
4 export function kebabToCamel(kebab: string): string {
5 const ucFirst = (word: string) => word.slice(0, 1).toUpperCase() + word.slice(1);
6 const words = kebab.split('-');
7 return words[0] + words.slice(1).map(ucFirst).join('');
11 * Convert a camelCase string to a kebab-case string.
13 export function camelToKebab(camelStr: string): string {
14 return camelStr.replace(/[A-Z]/g, (str, offset) => (offset > 0 ? '-' : '') + str.toLowerCase());