How do I sort/group the objects by the “group” values while still maintaining an alphabetical order (“name” value)?
E.g. Before
[{
name:'A'
group:'a',
},
{
name:'A'
group:'b',
},
{
name:'B'
group:'a',
},
{
name:'B'
group:'b'
}]
After
[{
name:'A'
group:'a',
},
{
name:'B'
group:'a',
},
{
name:'A'
group:'b',
},
{
name:'B'
group:'b'
}]
Check if the groups are equal, if so, compare names. If the groups are not equal, compare groups.