From 974306d4f08fc667d79b28351461df9ffe5e9a01 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 12 Jul 2015 10:08:57 -0700 Subject: [PATCH] Generalize the unwrapped value path in lazy method wrappers a bit. --- lodash.src.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lodash.src.js b/lodash.src.js index 52aba5e79..5769531f9 100644 --- a/lodash.src.js +++ b/lodash.src.js @@ -11680,9 +11680,8 @@ isLazy = useLazy = false; } var interceptor = function(value) { - return (retUnwrapped && chainAll) - ? lodashFunc(value, 1)[0] - : lodashFunc.apply(undefined, arrayPush([value], args)); + var result = lodashFunc.apply(lodash, arrayPush([value], args)); + return (retUnwrapped && chainAll) ? result[0] : result; }; var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined }, @@ -11692,13 +11691,14 @@ if (onlyLazy) { value = value.clone(); value.__actions__.push(action); - return func.call(value); + return func.apply(this, args); } - return lodashFunc.call(undefined, this.value())[0]; + var result = lodashFunc.apply(lodash, arrayPush([this.value()], args)); + return result[0]; } if (!retUnwrapped && useLazy) { value = onlyLazy ? value : new LazyWrapper(this); - var result = func.apply(value, args); + result = func.apply(value, args); result.__actions__.push(action); return new LodashWrapper(result, chainAll); }