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

Function callableOf

ark/schema/node.ts:202–215  ·  view source on GitHub ↗
(cache: NodeCache)

Source from the content-addressed store, hash-verified

200
201// what a node is called as, so a Type deferred until it's read is the same function
202const callableOf = (cache: NodeCache) =>
203 // not bound to a name, which a Type would have
204 (cache.self = (
205 data: any,
206 pipedFromCtx?: Traversal | undefined,
207 onFail?: ArkErrors.Handler | null
208 ) => {
209 if (pipedFromCtx) return pipeCalled(pipedFromCtx, cache.self, data)
210
211 const rootApply = cache.rootApply
212 return rootApply === undefined ?
213 cache.self.initRootApply()(data, onFail)
214 : rootApply(data, onFail)
215 })
216
217/** a callable and cache a Type holds until it's read, and then is a node of its kind */
218export const deferredCallable = (): { fn: Function; c: object } => {

Callers 2

deferredCallableFunction · 0.85
constructorFunction · 0.85

Calls 2

pipeCalledFunction · 0.85
rootApplyFunction · 0.85

Tested by

no test coverage detected