mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Adding the ability to _.sortBy(list, 'property')
This commit is contained in:
@@ -262,7 +262,8 @@
|
||||
};
|
||||
|
||||
// Sort the object's values by a criterion produced by an iterator.
|
||||
_.sortBy = function(obj, iterator, context) {
|
||||
_.sortBy = function(obj, val, context) {
|
||||
var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
|
||||
return _.pluck(_.map(obj, function(value, index, list) {
|
||||
return {
|
||||
value : value,
|
||||
|
||||
Reference in New Issue
Block a user