This line fails on part[0].toUpperCase() called by this from here from here errors with Cannot read properties of undefined (reading 'toUpperCase') in case the collection starts with an _ (example __backup_something_something).
Perhaps something along the lines of this -- remove all prefix _ and remove duplicate _
function upperCamelCase(value: string) {
return value.replace(/^_+/, '').replace(/_+/g, '_').split('_')
.map(part => part[0].toUpperCase() + part.substring(1).toLowerCase())
.join('');
}