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

Function failsValue

ark/type/checkers.ts:695–712  ·  view source on GitHub ↗
(
	ctx: FailureContext | number | undefined,
	checker: Checker,
	data: any,
	k: PropertyKey,
	value: unknown
)

Source from the content-addressed store, hash-verified

693// with a ctx, a value is applied once, as arktype applies it, since a callback
694// may see each call; one that transforms is checked first where arktype checks it
695const failsValue = (
696 ctx: FailureContext | number | undefined,
697 checker: Checker,
698 data: any,
699 k: PropertyKey,
700 value: unknown
701): boolean | undefined =>
702 (ctx as FailureContext | undefined)?._e ?
703 appliesValues && checker.e ? checker.e(ctx, checker, value, k)
704 : appliesValues && checker.t?.e ? checker.t.e(ctx, checker, value, k)
705 : (!checker.t ||
706 !(appliesValues && checker.a ?
707 // as arktype, a value reading its ctx is applied once where
708 // one only checks, as Allows does
709 !(ctx as any).chkOnly && checker.a(value, ctx, k)
710 : checker(value))) &&
711 (ctx as FailureContext)._k(checker as CompactApply, data, k)
712 : !checker(value)
713
714// keys checked in declared order; a missing key expects its checker's
715// description. A shape checking more than its keys walks them through this,

Callers 2

checkerFunction · 0.70
checkers.tsFile · 0.70

Calls 3

aMethod · 0.80
checkerFunction · 0.70
_kMethod · 0.65

Tested by

no test coverage detected