(obj, path, index)
| 29011 | |
| 29012 | { |
| 29013 | var copyWithDeleteImpl = function (obj, path, index) { |
| 29014 | var key = path[index]; |
| 29015 | var updated = isArray(obj) ? obj.slice() : assign({}, obj); |
| 29016 | |
| 29017 | if (index + 1 === path.length) { |
| 29018 | if (isArray(updated)) { |
| 29019 | updated.splice(key, 1); |
| 29020 | } else { |
| 29021 | delete updated[key]; |
| 29022 | } |
| 29023 | |
| 29024 | return updated; |
| 29025 | } // $FlowFixMe number or string is fine here |
| 29026 | |
| 29027 | |
| 29028 | updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); |
| 29029 | return updated; |
| 29030 | }; |
| 29031 | |
| 29032 | var copyWithDelete = function (obj, path) { |
| 29033 | return copyWithDeleteImpl(obj, path, 0); |
no test coverage detected
searching dependent graphs…