Ensure cloneByPath preserves uncloneable values. [closes #3203]

This commit is contained in:
John-David Dalton
2017-06-14 07:17:44 -07:00
parent 912d6b04a1
commit 5a3ff73997
3 changed files with 19 additions and 2 deletions

View File

@@ -171,7 +171,9 @@ function baseConvert(util, name, func, options) {
'curry': util.curry,
'forEach': util.forEach,
'isArray': util.isArray,
'isError': util.isError,
'isFunction': util.isFunction,
'isWeakMap': util.isWeakMap,
'iteratee': util.iteratee,
'keys': util.keys,
'rearg': util.rearg,
@@ -185,7 +187,9 @@ function baseConvert(util, name, func, options) {
curry = helpers.curry,
each = helpers.forEach,
isArray = helpers.isArray,
isError = helpers.isError,
isFunction = helpers.isFunction,
isWeakMap = helpers.isWeakMap,
keys = helpers.keys,
rearg = helpers.rearg,
toInteger = helpers.toInteger,
@@ -355,8 +359,9 @@ function baseConvert(util, name, func, options) {
var key = path[index],
value = nested[key];
if (value != null) {
nested[path[index]] = clone(index == lastIndex ? value : Object(value));
if (value != null &&
!(isFunction(value) || isError(value) || isWeakMap(value))) {
nested[key] = clone(index == lastIndex ? value : Object(value));
}
nested = nested[key];
}