mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 03:47:50 +00:00
_.uniq(): Remove unused previous variable.
This commit is contained in:
@@ -371,10 +371,10 @@
|
|||||||
// been sorted, you have the option of using a faster algorithm.
|
// been sorted, you have the option of using a faster algorithm.
|
||||||
// Aliased as `unique`.
|
// Aliased as `unique`.
|
||||||
_.uniq = _.unique = function(array, isSorted, iterator) {
|
_.uniq = _.unique = function(array, isSorted, iterator) {
|
||||||
var results = [], previous;
|
var results = [];
|
||||||
_.reduce(iterator ? _.map(array, iterator) : array, function (memo, value, index) {
|
_.reduce(iterator ? _.map(array, iterator) : array, function (memo, value, index) {
|
||||||
if (array.length < 3 || isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) {
|
if (array.length < 3 || isSorted ? _.last(memo) !== value || !memo.length : !_.include(memo, value)) {
|
||||||
memo.push(previous = value);
|
memo.push(value);
|
||||||
results.push(array[index]);
|
results.push(array[index]);
|
||||||
}
|
}
|
||||||
return memo;
|
return memo;
|
||||||
|
|||||||
Reference in New Issue
Block a user