mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 18:17:48 +00:00
Pop stacks when possible.
This commit is contained in:
21
lodash.js
21
lodash.js
@@ -2338,14 +2338,17 @@
|
|||||||
if (!isArr) {
|
if (!isArr) {
|
||||||
var props = isFull ? getAllKeys(value) : keys(value);
|
var props = isFull ? getAllKeys(value) : keys(value);
|
||||||
}
|
}
|
||||||
// Recursively populate clone (susceptible to call stack limits).
|
|
||||||
arrayEach(props || value, function(subValue, key) {
|
arrayEach(props || value, function(subValue, key) {
|
||||||
if (props) {
|
if (props) {
|
||||||
key = subValue;
|
key = subValue;
|
||||||
subValue = value[key];
|
subValue = value[key];
|
||||||
}
|
}
|
||||||
|
// Recursively populate clone (susceptible to call stack limits).
|
||||||
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
||||||
});
|
});
|
||||||
|
if (!isFull) {
|
||||||
|
stack['delete'](value);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3249,13 +3252,12 @@
|
|||||||
isCommon = false;
|
isCommon = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stack.set(srcValue, newValue);
|
|
||||||
|
|
||||||
if (isCommon) {
|
if (isCommon) {
|
||||||
// Recursively merge objects and arrays (susceptible to call stack limits).
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||||
|
stack.set(srcValue, newValue);
|
||||||
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
||||||
|
stack['delete'](srcValue);
|
||||||
}
|
}
|
||||||
stack['delete'](srcValue);
|
|
||||||
assignMergeValue(object, key, newValue);
|
assignMergeValue(object, key, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5193,10 +5195,12 @@
|
|||||||
return stacked == other;
|
return stacked == other;
|
||||||
}
|
}
|
||||||
bitmask |= UNORDERED_COMPARE_FLAG;
|
bitmask |= UNORDERED_COMPARE_FLAG;
|
||||||
stack.set(object, other);
|
|
||||||
|
|
||||||
// Recursively compare objects (susceptible to call stack limits).
|
// Recursively compare objects (susceptible to call stack limits).
|
||||||
return equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
|
stack.set(object, other);
|
||||||
|
var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
|
||||||
|
stack['delete'](object);
|
||||||
|
return result;
|
||||||
|
|
||||||
case symbolTag:
|
case symbolTag:
|
||||||
if (symbolValueOf) {
|
if (symbolValueOf) {
|
||||||
@@ -5937,7 +5941,10 @@
|
|||||||
*/
|
*/
|
||||||
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
|
function mergeDefaults(objValue, srcValue, key, object, source, stack) {
|
||||||
if (isObject(objValue) && isObject(srcValue)) {
|
if (isObject(objValue) && isObject(srcValue)) {
|
||||||
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack.set(srcValue, objValue));
|
// Recursively merge objects and arrays (susceptible to call stack limits).
|
||||||
|
stack.set(srcValue, objValue);
|
||||||
|
baseMerge(objValue, srcValue, undefined, mergeDefaults, stack);
|
||||||
|
stack['delete'](srcValue);
|
||||||
}
|
}
|
||||||
return objValue;
|
return objValue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user