(root: unknown, path: string)
| 100 | } |
| 101 | |
| 102 | function getPathValue(root: unknown, path: string): unknown { |
| 103 | const parts = path.split("."); |
| 104 | let cursor: unknown = root; |
| 105 | for (const part of parts) { |
| 106 | if (!isRecord(cursor) || !(part in cursor)) return undefined; |
| 107 | cursor = cursor[part]; |
| 108 | } |
| 109 | return cursor; |
| 110 | } |
| 111 | |
| 112 | function formatValue(value: unknown): string { |
| 113 | if (typeof value === "string") return JSON.stringify(value); |
no test coverage detected