Ensure index in baseSortByOrder is an integer.

This commit is contained in:
jdalton
2015-04-13 09:30:01 -07:00
parent 63d493aa1f
commit 520f7c6812

View File

@@ -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) {