mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Update _.sortBy doc example with preferred usage. [ci skip]
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user