Following up on this example, something like this in underscore.js...
items = _.sortBy(items, function(item){ return item.value });
...is more or less the same with the function getting wrapped in an array in lodash like this:
items = _.sortBy(items, [function(item){ return item.value }]);
Add .reverse() just before the semicolon to make the ordering go the other direction in either case.
No comments:
Post a Comment