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

Function findDynamic

ark/aot/interpreter.ts:3253–3265  ·  view source on GitHub ↗
(
	value: unknown,
	isWanted: (dynamic: DynamicValue) => boolean = () => true,
	seen = new Set<unknown>()
)

Source from the content-addressed store, hash-verified

3251 ))
3252
3253export const findDynamic = (
3254 value: unknown,
3255 isWanted: (dynamic: DynamicValue) => boolean = () => true,
3256 seen = new Set<unknown>()
3257): DynamicValue | undefined => {
3258 if (isDynamic(value)) return isWanted(value) ? value : undefined
3259 if (!isPlainContainer(value) || seen.has(value)) return
3260 seen.add(value)
3261 for (const k of Reflect.ownKeys(value)) {
3262 const dynamic = findDynamic(Reflect.get(value, k), isWanted, seen)
3263 if (dynamic) return dynamic
3264 }
3265}
3266
3267const collectHoles = (
3268 value: unknown,

Callers 15

refusedDefinitionOfMethod · 0.90
PrecompilerClass · 0.90
rejectionOfFunction · 0.90
interpretFunction · 0.90
evaluateNodeMethod · 0.85
overwriteProblemMethod · 0.85
evaluateUnaryMethod · 0.85
evaluateBinaryMethod · 0.85
evaluateReferenceMethod · 0.85
markDeclaredMethod · 0.85
destructureMethod · 0.85

Calls 5

isPlainContainerFunction · 0.90
isDynamicFunction · 0.85
getMethod · 0.65
hasMethod · 0.45
addMethod · 0.45

Tested by 1

interpretFunction · 0.72