From 83ac1686640848a72258c15ce977c40ecd17ba79 Mon Sep 17 00:00:00 2001 From: jdalton Date: Sun, 5 Jul 2015 20:18:22 -0700 Subject: [PATCH] Simplify `getIteratee` assignments in methods. --- lodash.src.js | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index bd7157a1b..e94dc25b7 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -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); } /**