0👍
This might help you:
transformModels(models) {
const transformedModels = {};
models.forEach(model => {
if(!transformedModels[model.node]) {
transformedModels[model.node] = [];
}
transformedModels[model.node].push(model);
});
return transformedModels;
}
nodes = transformModels(models);
Source:stackexchange.com