mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
Simplify array mapping in basePullAll and baseOrderBy.
This commit is contained in:
10
lodash.js
10
lodash.js
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user