(parentPath: (string | number)[], key: string | number)
| 69 | p.reduce((acc, k) => (acc == null ? acc : acc[k]), root); |
| 70 | |
| 71 | const wrap = (parentPath: (string | number)[], key: string | number) => { |
| 72 | return (...args: any[]) => { |
| 73 | const latestParent = getByPath(ref.current, parentPath); |
| 74 | const latestFn: any = latestParent?.[key]; |
| 75 | if (typeof latestFn === 'function') { |
| 76 | return latestFn.apply(latestParent, args); |
| 77 | } |
| 78 | }; |
| 79 | }; |
| 80 | |
| 81 | const visit = (v: any): any => { |
| 82 | if (typeof v === 'function') { |