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

Function props

ark/aot/settingsValidators.ts:623–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

621 ctx._k(checker, data, k)
622 : !checker(value)
623var props = declared => {
624 const checker = (data, ctx) => {
625 if (!objectCheck.test(data)) return !failsAt(ctx, objectCheck, data)
626 for (const k in declared) {
627 const value = data[k]
628 if (
629 value === void 0 && !(k in data) ?
630 // entered by the ctx, which fails a key missing from data as
631 // required with what it's passed: what its checker holds for
632 // it, the description it expects, the message it says and
633 // what notes one that's its code's
634 !declared[k].o &&
635 (!ctx?._e ||
636 ctx._k(
637 declared[k],
638 data,
639 k,
640 declared[k].description,
641 declared[k].x,
642 declared[k].text
643 ))
644 : failsValue(ctx, declared[k], data, k, value)
645 )
646 return false
647 }
648 return true
649 }
650 checker.description = objectCheck.description
651 return checker
652}
653var closedProps = (declared, description = "removed") => {
654 const removed = siteOf("undeclared", description)
655 const walks = props(declared)

Callers 2

closedPropsFunction · 0.70
sitedPropsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected