Simplify array mapping in basePullAll and baseOrderBy.

This commit is contained in:
John-David Dalton
2016-02-27 18:42:24 -08:00
parent e842bec025
commit 98bdd67cf2

View File

@@ -3227,12 +3227,8 @@
* @returns {Array} Returns the new sorted array. * @returns {Array} Returns the new sorted array.
*/ */
function baseOrderBy(collection, iteratees, orders) { function baseOrderBy(collection, iteratees, orders) {
var index = -1, var index = -1;
toIteratee = getIteratee(); iteratees = arrayMap(iteratees.length ? iteratees : Array(1), getIteratee());
iteratees = arrayMap(iteratees.length ? iteratees : Array(1), function(iteratee) {
return toIteratee(iteratee);
});
var result = baseMap(collection, function(value, key, collection) { var result = baseMap(collection, function(value, key, collection) {
var criteria = arrayMap(iteratees, function(iteratee) { var criteria = arrayMap(iteratees, function(iteratee) {
@@ -3327,7 +3323,7 @@
seen = array; seen = array;
if (iteratee) { if (iteratee) {
seen = arrayMap(array, function(value) { return iteratee(value); }); seen = arrayMap(array, baseUnary(iteratee));
} }
while (++index < length) { while (++index < length) {
var fromIndex = 0, var fromIndex = 0,