MCPcopy Create free account
hub / github.com/arktypeio/arktype / byAncestorPath

Function byAncestorPath

ark/schema/shared/errorReaders.ts:63–76  ·  view source on GitHub ↗
(
	errors: ReadableErrors<issue>
)

Source from the content-addressed store, hash-verified

61 * at that path or any nested path within it.
62 */
63export 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

Callers 2

expectedByAncestorPathFunction · 0.85
traverse.test.tsFile · 0.85

Calls 1

addEntryFunction · 0.85

Tested by 1

expectedByAncestorPathFunction · 0.68