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

Function byPath

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

Source from the content-addressed store, hash-verified

22 * The first error at each path, by the string of the path.
23 */
24export const byPath = <issue extends PathedIssue>(
25 errors: ReadableErrors<issue>
26): Record<string, issue> => {
27 const result: Record<string, issue> = {}
28 for (const error of errors.issues) {
29 const k = propStringOf(error)
30 if (!hasOwn(result, k)) defineEntry(result, k, error)
31 }
32 return result
33}
34
35/**
36 * Each path's errors, by the string of the path.

Callers 2

traverse.test.tsFile · 0.50
label.test.tsFile · 0.50

Calls 3

hasOwnFunction · 0.90
propStringOfFunction · 0.85
defineEntryFunction · 0.85

Tested by

no test coverage detected