let str = 'SOME_NAME_IVAN';
// вывод someNameIvan
const toCamelCase = (string = '') => {
const value = (string.toLowerCase().match(/[a-z]+[0-9]*|[0-9]+/g) ?? [])
.map((x) => x.slice(0, 1).toUpperCase() + x.slice(1))
.join('');
return value.slice(0, 1).toLowerCase() + value.slice(1);
};
toCamelCase() // ''
toCamelCase('SOME_NAME_IVAN') // 'someNameIvan'
toCamelCase('my-super-key') // 'mySuperKey'