From b51786e72e8b6810be2e09a7bfb37816560d67c5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 8 Dec 2016 22:28:27 -0800 Subject: [PATCH] Fix lazy sequence test fails. --- lodash.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lodash.js b/lodash.js index de679cb5c..b60c9ed6e 100644 --- a/lodash.js +++ b/lodash.js @@ -1876,7 +1876,7 @@ resIndex = 0, takeCount = nativeMin(length, this.__takeCount__); - if (!isArr || (arrLength == length && takeCount == length)) { + if (!isArr || (!isRight && arrLength == length && takeCount == length)) { return baseWrapperValue(array, this.__actions__); } var result = []; @@ -16836,14 +16836,13 @@ // Add `LazyWrapper` methods for `_.drop` and `_.take` variants. arrayEach(['drop', 'take'], function(methodName, index) { LazyWrapper.prototype[methodName] = function(n) { - var filtered = this.__filtered__; - if (filtered && !index) { - return new LazyWrapper(this); - } n = n === undefined ? 1 : nativeMax(toInteger(n), 0); - var result = this.clone(); - if (filtered) { + var result = (this.__filtered__ && !index) + ? new LazyWrapper(this) + : this.clone(); + + if (result.__filtered__) { result.__takeCount__ = nativeMin(n, result.__takeCount__); } else { result.__views__.push({