Update _.sortBy doc example with preferred usage. [ci skip]

This commit is contained in:
John-David Dalton
2016-08-15 08:22:32 -07:00
parent 1c4fccc0fd
commit d11aa6de06

View File

@@ -9575,16 +9575,11 @@
* { 'user': 'barney', 'age': 34 }
* ];
*
* _.sortBy(users, function(o) { return o.user; });
* _.sortBy(users, [function(o) { return o.user; }]);
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*
* _.sortBy(users, ['user', 'age']);
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
*
* _.sortBy(users, 'user', function(o) {
* return Math.floor(o.age / 10);
* });
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
*/
var sortBy = baseRest(function(collection, iteratees) {
if (collection == null) {