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