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

Function scanLeaf

ark/type/deferred.ts:587–599  ·  view source on GitHub ↗
(def: string)

Source from the content-addressed store, hash-verified

585
586/** what a string so plain that parsing it can't throw says */
587const scanLeaf = (def: string): Facts | undefined => {
588 let facts = scanned.get(def)
589 if (facts === undefined) {
590 try {
591 facts = scanUncached(def) ?? null
592 } catch {
593 facts = null
594 }
595 if (scanned.size >= maxScannedDefs) scanned.clear()
596 scanned.set(def, facts)
597 }
598 return facts ?? undefined
599}
600
601const scanUncached = (def: string): Facts | undefined => {
602 const withDefault = defaulted.exec(def)

Callers 3

valueFactsFunction · 0.85
deferred.tsFile · 0.85
deferDefinitionFunction · 0.85

Calls 3

scanUncachedFunction · 0.85
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected