* Creates a clone of `object` by `path`. * * @private * @param {Object} object The object to clone. * @param {Array|string} path The path to clone by. * @returns {Object} Returns the cloned object.
(object, path)
| 346 | * @returns {Object} Returns the cloned object. |
| 347 | */ |
| 348 | function cloneByPath(object, path) { |
| 349 | path = toPath(path); |
| 350 | |
| 351 | var index = -1, |
| 352 | length = path.length, |
| 353 | lastIndex = length - 1, |
| 354 | result = clone(Object(object)), |
| 355 | nested = result; |
| 356 | |
| 357 | while (nested != null && ++index < length) { |
| 358 | var key = path[index], |
| 359 | value = nested[key]; |
| 360 | |
| 361 | if (value != null && |
| 362 | !(isFunction(value) || isError(value) || isWeakMap(value))) { |
| 363 | nested[key] = clone(index == lastIndex ? value : Object(value)); |
| 364 | } |
| 365 | nested = nested[key]; |
| 366 | } |
| 367 | return result; |
| 368 | } |
| 369 | |
| 370 | /** |
| 371 | * Converts `lodash` to an immutable auto-curried iteratee-first data-last |
nothing calls this directly
no test coverage detected