Closed KevinKGifford closed 9 years ago
You will need to first use _.paris to convert this object to an array form, like
[ ['ASEN', 4.9], ['CHEN', 4.42], ....]
then you can use _.sortBy
to operate on this array
Thanks! And I'm a bit peeved at myself because I read over _.pairs thinking it might be a candidate to perform this operation but decided (wrongly) that it wasn't what I needed. Thanks again for the expert assistance.
Is it permissible/doable to sort a key-value object? I have the following as an object from _.mapValues():
{ "ASEN": 4.9, "CHEN": 4.42, "CSCI": 4.55, "CVEN": 4.87, "ECEN": 4.57, "EMEN": 4.97, "ENGR": 4.74, "EVEN": 4.69, "HUEN": 5.37, "MCEN": 4.48, "TLEN": 4.82 }
Easy enough to display in a table, but I'd like to sort the table entries (rows) based on the value of the key (so "HUEN": 5.37 would be the first row and "CHEN": 4.42 would be the last of the 11 rows). Any suggestions would be appreciated.