mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
Ensure index in baseSortByOrder is an integer.
This commit is contained in:
@@ -2846,12 +2846,14 @@
|
||||
* @returns {Array} Returns the new sorted array.
|
||||
*/
|
||||
function baseSortByOrder(collection, iteratees, orders) {
|
||||
var callback = getCallback();
|
||||
var callback = getCallback(),
|
||||
index = -1;
|
||||
|
||||
iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });
|
||||
|
||||
var result = baseMap(collection, function(value, index) {
|
||||
var result = baseMap(collection, function(value) {
|
||||
var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });
|
||||
return { 'criteria': criteria, 'index': index, 'value': value };
|
||||
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
||||
});
|
||||
|
||||
return baseSortBy(result, function(object, other) {
|
||||
|
||||
Reference in New Issue
Block a user