Skip to content

Instantly share code, notes, and snippets.

@csclyde
Created November 22, 2017 21:26
Show Gist options
  • Save csclyde/cfe0d7825a820059df034005b11267dc to your computer and use it in GitHub Desktop.
Save csclyde/cfe0d7825a820059df034005b11267dc to your computer and use it in GitHub Desktop.
groupsCalculated: (state) => {
var groups = state.all.reduce((acc, val) => {
if(!acc[val.name]) {
acc[val.name] = {
name: val.name,
id: val.id,
networks: []
};
}
acc[val.name].networks.push({
service_id: val.service_id,
login_id: val.login_id
});
return acc;
}, {});
return Object.values(groups);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment