mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Bump to v4.7.0.
This commit is contained in:
10
orderBy.js
10
orderBy.js
@@ -11,24 +11,26 @@ define(['./_baseOrderBy', './isArray'], function(baseOrderBy, isArray) {
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function[]|Object[]|string[]} [iteratees=[_.identity]] The iteratees to sort by.
|
||||
* @param {Array[]|Function[]|Object[]|string[]} [iteratees=[_.identity]]
|
||||
* The iteratees to sort by.
|
||||
* @param {string[]} [orders] The sort orders of `iteratees`.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for functions like `_.reduce`.
|
||||
* @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
|
||||
* @returns {Array} Returns the new sorted array.
|
||||
* @example
|
||||
*
|
||||
* var users = [
|
||||
* { 'user': 'fred', 'age': 48 },
|
||||
* { 'user': 'barney', 'age': 34 },
|
||||
* { 'user': 'fred', 'age': 42 },
|
||||
* { 'user': 'fred', 'age': 40 },
|
||||
* { 'user': 'barney', 'age': 36 }
|
||||
* ];
|
||||
*
|
||||
* // Sort by `user` in ascending order and by `age` in descending order.
|
||||
* _.orderBy(users, ['user', 'age'], ['asc', 'desc']);
|
||||
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]
|
||||
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
|
||||
*/
|
||||
function orderBy(collection, iteratees, orders, guard) {
|
||||
if (collection == null) {
|
||||
|
||||
Reference in New Issue
Block a user