| 63 | } |
| 64 | |
| 65 | function getTailValue(obj: any, addr: string): unknown { |
| 66 | if (!obj || typeof obj !== 'object') return null |
| 67 | const segments = addr.split('.') |
| 68 | let current = obj |
| 69 | for (const i in segments) { |
| 70 | const segment = segments[i] |
| 71 | // Use `in` so prototype members (class getters/methods) still resolve. |
| 72 | if (!(segment in current)) return undefined |
| 73 | const value = current[segment] |
| 74 | if (+i === segments.length - 1) { |
| 75 | return typeof value === 'function' ? value.bind(current) : value |
| 76 | } |
| 77 | if (!value || typeof value !== 'object') return undefined |
| 78 | current = value |
| 79 | } |
| 80 | return undefined |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Describes a registry of operators that occur at different periods during |