From 80f6990a436955220c4807f8e7473a72f636eedc Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 12 Sep 2015 22:29:19 -0700 Subject: [PATCH] Remove value guards in `baseDifference` and `baseSortedUniqBy`. --- lodash.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lodash.js b/lodash.js index 5289ad8ef..d7f68075e 100644 --- a/lodash.js +++ b/lodash.js @@ -1939,7 +1939,7 @@ * @returns {Array} Returns the new array of filtered values. */ function baseDifference(array, values) { - var length = array ? array.length : 0, + var length = array.length, result = []; if (!length) { @@ -2848,13 +2848,10 @@ * @returns {Array} Returns the new duplicate free array. */ function baseSortedUniqBy(array, iteratee) { - var length = array.length; - if (!length) { - return []; - } var index = 0, indexOf = getIndexOf(), isCommon = indexOf === baseIndexOf, + length = array.length, value = array[0], computed = iteratee ? iteratee(value) : value, seen = isCommon ? computed : [computed], @@ -5743,7 +5740,9 @@ : array; } } - return result ? baseUniq(result) : []; + return (result && result.length) + ? baseUniq(result) + : []; } /**