_.orderBy()
_.orderBy(collection, [iteratees=[_.identity]], [orders])
This method is like _.sortBy
except that it allows specifying the sort orders of the iteratees to sort by. If orders is unspecified, all values are sorted in ascending order. Otherwise, specify an order of "desc" for descending or "asc" for ascending sort order of corresponding values.
Arguments
collection (Array|Object)
: The collection to iterate over.
[iteratees=[_.identity]] (Array[]|Function[]|Object[]|string[])
: The iteratees to sort by.
[orders] (string[])
: The sort orders of iteratees.
Returns
(Array)
: Returns the new sorted array.