I know you're not supposed to sort javascript objects but I need to for a d3 chart. I have an object with a key of FICO score ranges and value of the count of how many in that range
var counts = {680-700: 30, 620-640: 41, 640-660: 24, 660-680: 10}
I need to return a sorted object such that the lowest value keys come first.
var desired_obj = { 620-640: 41, 640-660: 24, 660-680: 10, 680-700: 30 }
I attempted to use _.sortBy but it only returns the values
_.sortBy(counts, function(val, key) { return val })