(
obj: Object | Array<any>,
path: Array<string | number>,
index: number,
value: any,
)
| 684 | }; |
| 685 | |
| 686 | const copyWithSetImpl = ( |
| 687 | obj: Object | Array<any>, |
| 688 | path: Array<string | number>, |
| 689 | index: number, |
| 690 | value: any, |
| 691 | ): $FlowFixMe => { |
| 692 | if (index >= path.length) { |
| 693 | return value; |
| 694 | } |
| 695 | const key = path[index]; |
| 696 | const updated = isArray(obj) ? obj.slice() : {...obj}; |
| 697 | // $FlowFixMe[incompatible-use] number or string is fine here |
| 698 | updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); |
| 699 | return updated; |
| 700 | }; |
| 701 | |
| 702 | const copyWithSet = ( |
| 703 | obj: Object | Array<any>, |
no test coverage detected