mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47: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)) {
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
||||||
predicate = undefined;
|
predicate = undefined;
|
||||||
}
|
}
|
||||||
if (typeof predicate != 'function') {
|
return func(collection, getIteratee(predicate));
|
||||||
predicate = getIteratee(predicate);
|
|
||||||
}
|
|
||||||
return func(collection, predicate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6020,8 +6017,7 @@
|
|||||||
*/
|
*/
|
||||||
function filter(collection, predicate) {
|
function filter(collection, predicate) {
|
||||||
var func = isArray(collection) ? arrayFilter : baseFilter;
|
var func = isArray(collection) ? arrayFilter : baseFilter;
|
||||||
predicate = getIteratee(predicate);
|
return func(collection, getIteratee(predicate));
|
||||||
return func(collection, predicate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6337,8 +6333,7 @@
|
|||||||
*/
|
*/
|
||||||
function map(collection, iteratee) {
|
function map(collection, iteratee) {
|
||||||
var func = isArray(collection) ? arrayMap : baseMap;
|
var func = isArray(collection) ? arrayMap : baseMap;
|
||||||
iteratee = getIteratee(iteratee);
|
return func(collection, getIteratee(iteratee));
|
||||||
return func(collection, iteratee);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -6619,10 +6614,7 @@
|
|||||||
if (guard && isIterateeCall(collection, predicate, guard)) {
|
if (guard && isIterateeCall(collection, predicate, guard)) {
|
||||||
predicate = undefined;
|
predicate = undefined;
|
||||||
}
|
}
|
||||||
if (typeof predicate != 'function') {
|
return func(collection, getIteratee(predicate));
|
||||||
predicate = getIteratee(predicate);
|
|
||||||
}
|
|
||||||
return func(collection, predicate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8866,8 +8858,7 @@
|
|||||||
* // => 'barney'
|
* // => 'barney'
|
||||||
*/
|
*/
|
||||||
function findKey(object, predicate) {
|
function findKey(object, predicate) {
|
||||||
predicate = getIteratee(predicate);
|
return baseFind(object, getIteratee(predicate), baseForOwn, true);
|
||||||
return baseFind(object, predicate, baseForOwn, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -8904,8 +8895,7 @@
|
|||||||
* // => 'pebbles'
|
* // => 'pebbles'
|
||||||
*/
|
*/
|
||||||
function findLastKey(object, predicate) {
|
function findLastKey(object, predicate) {
|
||||||
predicate = getIteratee(predicate);
|
return baseFind(object, getIteratee(predicate), baseForOwnRight, true);
|
||||||
return baseFind(object, predicate, baseForOwnRight, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user