mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +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.
|
* @returns {Array} Returns the new sorted array.
|
||||||
*/
|
*/
|
||||||
function baseSortByOrder(collection, iteratees, orders) {
|
function baseSortByOrder(collection, iteratees, orders) {
|
||||||
var callback = getCallback();
|
var callback = getCallback(),
|
||||||
|
index = -1;
|
||||||
|
|
||||||
iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });
|
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); });
|
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) {
|
return baseSortBy(result, function(object, other) {
|
||||||
|
|||||||
Reference in New Issue
Block a user