Closed Trevoke closed 8 years ago
Ignore me, that actually works just fine if you use something like:
var n = require("natural-sort")
var i = require("immutable")
var a = i.fromJS([{a: '1', field: "1a", name:'Alphonse'},
{a: '5', field: "a", name: 'Bethany'},
{a: '5', field: "B", name: 'George'},
{a: '8', field: "1", name: 'Donald'},
{a: '9', field: "10", name: 'Clothilde'}
])
b = a.sortBy(function(x) { return x.get('name'); }, n())
:+1: Thanks for sharing your thoughs! @bck2207 perhaps an example like this is worth showing in the readme?
I was happily surprised to see that this works with Facebook's immutable! (that should be in the README, it's an attractive quality).
I would love it if I could specify a particular field in a nested structure, say, a list of maps, and sorting the list of maps based on that field on the maps.