mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 17:47:49 +00:00
Ensure lazy takeWhile works with reverse and last`. [closes #990]
This commit is contained in:
@@ -11437,7 +11437,7 @@
|
||||
filtered = result.__filtered__,
|
||||
iteratees = result.__iteratees__ || (result.__iteratees__ = []);
|
||||
|
||||
result.__filtered__ = filtered || isFilter || (isWhile && result.__dir__ < 0);
|
||||
result.__filtered__ = filtered || isFilter || isWhile;
|
||||
iteratees.push({ 'iteratee': getCallback(iteratee, thisArg, 3), 'type': index });
|
||||
return result;
|
||||
};
|
||||
@@ -11504,9 +11504,14 @@
|
||||
};
|
||||
|
||||
LazyWrapper.prototype.dropWhile = function(predicate, thisArg) {
|
||||
var done;
|
||||
var done,
|
||||
lastIndex,
|
||||
isRight = this.__dir__ < 0;
|
||||
|
||||
predicate = getCallback(predicate, thisArg, 3);
|
||||
return this.filter(function(value, index, array) {
|
||||
done = done && (isRight ? index < lastIndex : index > lastIndex);
|
||||
lastIndex = index;
|
||||
return done || (done = !predicate(value, index, array));
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user