Remove value guards in baseDifference and baseSortedUniqBy.

This commit is contained in:
John-David Dalton
2015-09-12 22:29:19 -07:00
parent 0d5f8437f5
commit 80f6990a43

View File

@@ -1939,7 +1939,7 @@
* @returns {Array} Returns the new array of filtered values. * @returns {Array} Returns the new array of filtered values.
*/ */
function baseDifference(array, values) { function baseDifference(array, values) {
var length = array ? array.length : 0, var length = array.length,
result = []; result = [];
if (!length) { if (!length) {
@@ -2848,13 +2848,10 @@
* @returns {Array} Returns the new duplicate free array. * @returns {Array} Returns the new duplicate free array.
*/ */
function baseSortedUniqBy(array, iteratee) { function baseSortedUniqBy(array, iteratee) {
var length = array.length;
if (!length) {
return [];
}
var index = 0, var index = 0,
indexOf = getIndexOf(), indexOf = getIndexOf(),
isCommon = indexOf === baseIndexOf, isCommon = indexOf === baseIndexOf,
length = array.length,
value = array[0], value = array[0],
computed = iteratee ? iteratee(value) : value, computed = iteratee ? iteratee(value) : value,
seen = isCommon ? computed : [computed], seen = isCommon ? computed : [computed],
@@ -5743,7 +5740,9 @@
: array; : array;
} }
} }
return result ? baseUniq(result) : []; return (result && result.length)
? baseUniq(result)
: [];
} }
/** /**