Is it possible to sort a collection of objects (not an array)? I’m looking at something like this:
{
"dbcc0a7c-f0af-4253-9aa2-d70e65e68cca": {
"mttd": -86444,
"mtta": 0,
"mttm": null,
"mttr": null,
"count": 1,
"total_time": 1548933
},
"efc8611e-7b92-4885-b160-c69c91b654b2": {
"mttd": null,
"mtta": null,
"mttm": null,
"mttr": null,
"count": 0,
"total_time": null
},
"348c352d-5d61-445c-8fb9-c7081adae641": {
"mttd": null,
"mtta": 0,
"mttm": 448453,
"mttr": null,
"count": 1,
"total_time": 1897322
},
"e4a88b56-1c58-432e-afc6-79ddc87cc7f8": {
"mttd": null,
"mtta": 0,
"mttm": 92535,
"mttr": null,
"count": 2,
"total_time": 3090603
}
}
I need to sort by count. I tried this, but of course it doesn’t work since it’s just for arrays:
const sorted = data.sort((a, b) => {
return b.count - a.count;
});