I attempted to enhance the code by using reduce:
private getAllRegistryObjects(registry: RegistryGeneric) {
const registryLayerItemGeneric = [];
registry.RegistryLayers.forEach((layer) => {
layer.items.forEach((item) => {
registryLayerItemGeneric.push(item);
});
});
return registryLayerItemGeneric;
}
Instead, I have tried this:
return registry.RegistryLayers.reduce(function(previousValue, currentValue, currentIndex, array) {
return previousValue.concat(currentValue.items.flat());
}, [])
However, it resulted in an empty array being returned.