Ensure _#reverse doesn't augment the original array if it was sliced before. [closes #1323]

This commit is contained in:
John-David Dalton
2015-07-07 17:20:09 -07:00
parent 2e50d11be5
commit a80d0bc2ca
2 changed files with 87 additions and 61 deletions

View File

@@ -1205,7 +1205,7 @@
takeCount = nativeMin(length, this.__takeCount__);
if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {
return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);
return baseWrapperValue(array, this.__actions__);
}
var result = [];
@@ -6230,7 +6230,7 @@
var value = this.__wrapped__;
var interceptor = function(value) {
return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();
return value.reverse();
};
if (value instanceof LazyWrapper) {
var wrapped = value;