mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Fix lazy methods to execute non-lazy methods performed in between.
This commit is contained in:
committed by
John-David Dalton
parent
7cf40576dd
commit
8612946bf5
@@ -10266,7 +10266,7 @@
|
|||||||
: lodash[methodName](this.value());
|
: lodash[methodName](this.value());
|
||||||
}
|
}
|
||||||
if (isLazy || isArray(value)) {
|
if (isLazy || isArray(value)) {
|
||||||
var result = func.apply(isLazy ? value : new LazyWrapper(this), args);
|
var result = func.apply(isLazy && !this.__queue__.length ? value : new LazyWrapper(this), args);
|
||||||
return new LodashWrapper(result, chainAll);
|
return new LodashWrapper(result, chainAll);
|
||||||
}
|
}
|
||||||
return this.thru(function(value) {
|
return this.thru(function(value) {
|
||||||
|
|||||||
10
test/test.js
10
test/test.js
@@ -1894,6 +1894,16 @@
|
|||||||
deepEqual(_.compact(falsey.concat(array)), array);
|
deepEqual(_.compact(falsey.concat(array)), array);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should filter falsey values when in between lazy operators', 1, function () {
|
||||||
|
if (!isNpm) {
|
||||||
|
var wrapped = _(falsey).map(_.identity).compact().map(_.identity);
|
||||||
|
deepEqual(wrapped.value(), []);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest(2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test('should return a wrapped value when chaining', 2, function() {
|
test('should return a wrapped value when chaining', 2, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var wrapped = _(falsey).compact();
|
var wrapped = _(falsey).compact();
|
||||||
|
|||||||
Reference in New Issue
Block a user