mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Update _.sortBy doc example with preferred usage. [ci skip]
This commit is contained in:
@@ -9575,16 +9575,11 @@
|
|||||||
* { 'user': 'barney', 'age': 34 }
|
* { '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]]
|
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
|
||||||
*
|
*
|
||||||
* _.sortBy(users, ['user', 'age']);
|
* _.sortBy(users, ['user', 'age']);
|
||||||
* // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
|
* // => 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) {
|
var sortBy = baseRest(function(collection, iteratees) {
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user