(path: readonly PropertyKey[])
| 322 | } |
| 323 | |
| 324 | function formatIssuePath(path: readonly PropertyKey[]): string { |
| 325 | if (path.length === 0) return '<root>'; |
| 326 | |
| 327 | let out = ''; |
| 328 | for (const segment of path) { |
| 329 | if (typeof segment === 'number') { |
| 330 | out += `[${String(segment)}]`; |
| 331 | } else if (out.length === 0) { |
| 332 | out = camelToSnake(String(segment)); |
| 333 | } else { |
| 334 | out += `.${camelToSnake(String(segment))}`; |
| 335 | } |
| 336 | } |
| 337 | return out; |
| 338 | } |
| 339 | |
| 340 | function camelToSnake(value: string): string { |
| 341 | return value.replaceAll(/[A-Z]/g, (ch) => `_${ch.toLowerCase()}`); |
no test coverage detected