mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Simplify getIteratee assignments in methods.
This commit is contained in:
committed by
John-David Dalton
parent
8ac1a67b7d
commit
83ac168664
@@ -5977,10 +5977,7 @@
|
||||
if (guard && isIterateeCall(collection, predicate, guard)) {
|
||||
predicate = undefined;
|
||||
}
|
||||
if (typeof predicate != 'function') {
|
||||
predicate = getIteratee(predicate);
|
||||
}
|
||||
return func(collection, predicate);
|
||||
return func(collection, getIteratee(predicate));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6020,8 +6017,7 @@
|
||||
*/
|
||||
function filter(collection, predicate) {
|
||||
var func = isArray(collection) ? arrayFilter : baseFilter;
|
||||
predicate = getIteratee(predicate);
|
||||
return func(collection, predicate);
|
||||
return func(collection, getIteratee(predicate));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6337,8 +6333,7 @@
|
||||
*/
|
||||
function map(collection, iteratee) {
|
||||
var func = isArray(collection) ? arrayMap : baseMap;
|
||||
iteratee = getIteratee(iteratee);
|
||||
return func(collection, iteratee);
|
||||
return func(collection, getIteratee(iteratee));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6619,10 +6614,7 @@
|
||||
if (guard && isIterateeCall(collection, predicate, guard)) {
|
||||
predicate = undefined;
|
||||
}
|
||||
if (typeof predicate != 'function') {
|
||||
predicate = getIteratee(predicate);
|
||||
}
|
||||
return func(collection, predicate);
|
||||
return func(collection, getIteratee(predicate));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8866,8 +8858,7 @@
|
||||
* // => 'barney'
|
||||
*/
|
||||
function findKey(object, predicate) {
|
||||
predicate = getIteratee(predicate);
|
||||
return baseFind(object, predicate, baseForOwn, true);
|
||||
return baseFind(object, getIteratee(predicate), baseForOwn, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8904,8 +8895,7 @@
|
||||
* // => 'pebbles'
|
||||
*/
|
||||
function findLastKey(object, predicate) {
|
||||
predicate = getIteratee(predicate);
|
||||
return baseFind(object, predicate, baseForOwnRight, true);
|
||||
return baseFind(object, getIteratee(predicate), baseForOwnRight, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user