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

Function foundErrors

ark/schema/shared/issues.ts:669–680  ·  view source on GitHub ↗
(
	apply: CompactApply,
	data: unknown,
	onFail: Issues.Handler | null,
	Ctx: new () => Issues = Issues
)

Source from the content-addressed store, hash-verified

667
668// for callers reading every failure's issues as it returns, like assert
669export const foundErrors = (
670 apply: CompactApply,
671 data: unknown,
672 onFail: Issues.Handler | null,
673 Ctx: new () => Issues = Issues
674): unknown => {
675 const errors = new Ctx()
676 // as issuesOf, which a program of these never ships
677 apply(data, errors)
678 if (!errors._.length) errors._e(data, "predicate", "valid", "is invalid")
679 return onFail ? onFail(errors) : errors
680}
681
682type Keyed = Record<PropertyKey, unknown>
683

Callers

nothing calls this directly

Calls 3

onFailFunction · 0.85
_eMethod · 0.65
applyFunction · 0.50

Tested by

no test coverage detected