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

Function foundErrors

ark/schema/shared/issuesLean.ts:304–315  ·  view source on GitHub ↗
(
	apply: CompactApply,
	data: unknown,
	onFail: ((errors: Issues) => unknown) | null,
	Ctx: new () => Issues = Issues
)

Source from the content-addressed store, hash-verified

302}
303
304export const foundErrors = (
305 apply: CompactApply,
306 data: unknown,
307 onFail: ((errors: Issues) => unknown) | null,
308 Ctx: new () => Issues = Issues
309): unknown => {
310 const errors = new Ctx()
311 // as issuesOf, which a program of these never ships
312 apply(data, errors)
313 if (!errors._.length) errors._e(data, "predicate", "valid", "is invalid")
314 return onFail ? onFail(errors) : errors
315}
316
317export const throwIssues = (apply: CompactApply, data: unknown): never => {
318 const errors = new Issues()

Callers

nothing calls this directly

Calls 3

onFailFunction · 0.85
_eMethod · 0.65
applyFunction · 0.50

Tested by

no test coverage detected