mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Ensure _#plant resets iterator data of the cloned sequence.
This commit is contained in:
18
lodash.js
18
lodash.js
@@ -1486,11 +1486,10 @@
|
||||
* @private
|
||||
* @param {*} value The value to wrap.
|
||||
* @param {boolean} [chainAll] Enable chaining for all wrapper methods.
|
||||
* @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.
|
||||
*/
|
||||
function LodashWrapper(value, chainAll, actions) {
|
||||
function LodashWrapper(value, chainAll) {
|
||||
this.__wrapped__ = value;
|
||||
this.__actions__ = actions || [];
|
||||
this.__actions__ = [];
|
||||
this.__chain__ = !!chainAll;
|
||||
this.__index__ = 0;
|
||||
this.__values__ = undefined;
|
||||
@@ -4347,9 +4346,14 @@
|
||||
* @returns {Object} Returns the cloned wrapper.
|
||||
*/
|
||||
function wrapperClone(wrapper) {
|
||||
return wrapper instanceof LazyWrapper
|
||||
? wrapper.clone()
|
||||
: new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, copyArray(wrapper.__actions__));
|
||||
if (wrapper instanceof LazyWrapper) {
|
||||
return wrapper.clone();
|
||||
}
|
||||
var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
|
||||
result.__actions__ = wrapper.__actions__;
|
||||
result.__index__ = wrapper.__index__;
|
||||
result.__values__ = wrapper.__values__;
|
||||
return result;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
@@ -5950,6 +5954,8 @@
|
||||
|
||||
while (parent instanceof baseLodash) {
|
||||
var clone = wrapperClone(parent);
|
||||
clone.__index__ = 0;
|
||||
clone.__values__ = undefined;
|
||||
if (result) {
|
||||
previous.__wrapped__ = clone;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user