Reduce lazy wrapper for lazy first and last.

This commit is contained in:
John-David Dalton
2014-10-21 08:04:29 -07:00
parent 6ad7963347
commit d1d1be49ba

View File

@@ -10095,12 +10095,9 @@
isLazy = value instanceof LazyWrapper;
if (retUnwrapped && !chainAll) {
if (isLazy) {
return func.apply(value, args);
}
var otherArgs = [this.value()];
push.apply(otherArgs, args);
return lodash[methodName].apply(lodash, otherArgs);
return isLazy
? func.call(value)
: lodash[methodName](this.value());
}
if (isLazy || isArray(value)) {
var result = func.apply(isLazy ? value : new LazyWrapper(this), args);