Ensure reverse returns a LodashWrapper instance when chaining.

This commit is contained in:
John-David Dalton
2014-11-22 14:31:32 -08:00
parent 263c04aeb2
commit 2fd297c1e1
2 changed files with 18 additions and 19 deletions

View File

@@ -4982,12 +4982,10 @@
* // => [3, 2, 1]
*/
function wrapperReverse() {
var wrapped = this.__wrapped__;
if(wrapped instanceof LazyWrapper) {
return wrapped.reverse();
var value = this.__wrapped__;
if (value instanceof LazyWrapper) {
return new LodashWrapper(value.reverse());
}
return this.thru(function(value) {
return value.reverse();
});