I've done lodash _.countBy
and was returned an object like so...
sponsorCounts = { 300051: 2, 300055: 1, 300064: 6 }
Now I'd like to do a sort/order by descending value but all the examples I've found involve pushing data into a separate array to sort like so...
var sortable = [];
for (var sponsor in sponsorCounts)
sortable.push([sponsor, sponsorCounts[sponsor]])
sortable.sort(
function(a, b) {
return b[1] - a[1]
}
)
Which gives me an array... but I want to keep it in that original object so I can get it like...
sponsorCounts = { 300064: 6, 300051: 2, 300055: 1 }