From c3e5eaf8da471b9c28f192ca73aa8687bf7f8198 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 12 Sep 2014 00:24:53 -0700 Subject: [PATCH] Cleanup `join`, `pop`, `shift` chaining setup code. --- lodash.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lodash.js b/lodash.js index 75668fd24..f4874fc44 100644 --- a/lodash.js +++ b/lodash.js @@ -9631,13 +9631,13 @@ arrayEach(['join', 'pop', 'shift'], function(methodName) { var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { - var chainAll = this.__chain__; - if (!chainAll) { - return func.apply(this.value(), arguments); + var args = arguments; + if (!this.__chain__) { + return func.apply(this.value(), args); } - var result = new lodashWrapper(this.__wrapped__, chainAll, baseSlice(this.__queue__)); - result.__queue__.push([func, null, arguments]); - return result; + return this.tap(function(value) { + return func.apply(value, args); + }); }; });