(
obj: Object | Array<any>,
path: Array<string | number>,
index: number,
)
| 606 | |
| 607 | if (__DEV__) { |
| 608 | const copyWithDeleteImpl = ( |
| 609 | obj: Object | Array<any>, |
| 610 | path: Array<string | number>, |
| 611 | index: number, |
| 612 | ): $FlowFixMe => { |
| 613 | const key = path[index]; |
| 614 | const updated = isArray(obj) ? obj.slice() : {...obj}; |
| 615 | if (index + 1 === path.length) { |
| 616 | if (isArray(updated)) { |
| 617 | updated.splice(((key: any): number), 1); |
| 618 | } else { |
| 619 | delete updated[key]; |
| 620 | } |
| 621 | return updated; |
| 622 | } |
| 623 | // $FlowFixMe[incompatible-use] number or string is fine here |
| 624 | updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); |
| 625 | return updated; |
| 626 | }; |
| 627 | |
| 628 | const copyWithDelete = ( |
| 629 | obj: Object | Array<any>, |
no test coverage detected