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

Function tApply

ark/schema/structure/prop.ts:127–136  ·  view source on GitHub ↗
(data: object, ctx: InternalTraversal)

Source from the content-addressed store, hash-verified

125 }
126
127 tApply(data: object, ctx: InternalTraversal): void {
128 if (this.key in data) {
129 travKey(
130 this.key,
131 () => applyValue(this.value, (data as any)[this.key], ctx),
132 ctx
133 )
134 } else if (this.is("required"))
135 travKey(this.key, () => ctx.nodeError(this.errorCtx, data), ctx)
136 }
137
138 compile(js: NodeCompiler): void {
139 const expression = this.jsExpression(js)

Callers

nothing calls this directly

Calls 4

travKeyFunction · 0.90
applyValueFunction · 0.90
isMethod · 0.80
nodeErrorMethod · 0.45

Tested by

no test coverage detected