| 61 | * at that path or any nested path within it. |
| 62 | */ |
| 63 | export const byAncestorPath = <issue extends PathedIssue>( |
| 64 | errors: ReadableErrors<issue> |
| 65 | ): Record<string, issue[]> => { |
| 66 | const result: Record<string, issue[]> = {} |
| 67 | for (const error of errors.issues) { |
| 68 | let propString = "" |
| 69 | addEntry(result, propString, error) |
| 70 | for (const k of error.path) { |
| 71 | propString = appendStringifiedKey(propString, k) |
| 72 | addEntry(result, propString, error) |
| 73 | } |
| 74 | } |
| 75 | return result |
| 76 | } |
| 77 | |
| 78 | // a standalone validator's issue, or one another copy of arktype wrote, holds |
| 79 | // no propString, so its path is written as arktype would write it |