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

Function applyErrors

ark/type/runtime.ts:1023–1038  ·  view source on GitHub ↗
(
	apply: CompactApply,
	data: unknown,
	config: unknown,
	onFail: ArkErrors.Handler | null,
	Ctx: new (data: unknown, config: unknown) => ArkErrors | InternalTraversal
)

Source from the content-addressed store, hash-verified

1021
1022// compact roots report into ArkErrors, loading no Traversal
1023export const applyErrors = (
1024 apply: CompactApply,
1025 data: unknown,
1026 config: unknown,
1027 onFail: ArkErrors.Handler | null,
1028 Ctx: new (data: unknown, config: unknown) => ArkErrors | InternalTraversal
1029): unknown => {
1030 const ctx = new Ctx(data, config)
1031 apply(data, ctx)
1032 const errors = ctx instanceof ArkErrors ? ctx : ctx._errors
1033 return (
1034 !errors?.count ? data
1035 : onFail ? onFail(errors)
1036 : errors
1037 )
1038}
1039
1040export const applyNodeErrors = (
1041 node: { tApply: CompactApply },

Callers 1

applyNodeErrorsFunction · 0.85

Calls 2

onFailFunction · 0.85
applyFunction · 0.50

Tested by

no test coverage detected