mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Generalize the unwrapped value path in lazy method wrappers a bit.
This commit is contained in:
@@ -11680,9 +11680,8 @@
|
|||||||
isLazy = useLazy = false;
|
isLazy = useLazy = false;
|
||||||
}
|
}
|
||||||
var interceptor = function(value) {
|
var interceptor = function(value) {
|
||||||
return (retUnwrapped && chainAll)
|
var result = lodashFunc.apply(lodash, arrayPush([value], args));
|
||||||
? lodashFunc(value, 1)[0]
|
return (retUnwrapped && chainAll) ? result[0] : result;
|
||||||
: lodashFunc.apply(undefined, arrayPush([value], args));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined },
|
var action = { 'func': thru, 'args': [interceptor], 'thisArg': undefined },
|
||||||
@@ -11692,13 +11691,14 @@
|
|||||||
if (onlyLazy) {
|
if (onlyLazy) {
|
||||||
value = value.clone();
|
value = value.clone();
|
||||||
value.__actions__.push(action);
|
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) {
|
if (!retUnwrapped && useLazy) {
|
||||||
value = onlyLazy ? value : new LazyWrapper(this);
|
value = onlyLazy ? value : new LazyWrapper(this);
|
||||||
var result = func.apply(value, args);
|
result = func.apply(value, args);
|
||||||
result.__actions__.push(action);
|
result.__actions__.push(action);
|
||||||
return new LodashWrapper(result, chainAll);
|
return new LodashWrapper(result, chainAll);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user