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

Method get

ark/aot/cache.ts:190–196  ·  view source on GitHub ↗
(key: string, holds: (snapshot: string) => boolean)

Source from the content-addressed store, hash-verified

188
189 // an answer stored for the key whose snapshot still holds
190 get(key: string, holds: (snapshot: string) => boolean): unknown {
191 const stored = this.read(`a-${key}`) as
192 | { snapshot: string; answer: unknown }
193 | undefined
194 if (stored && isHash(stored.snapshot) && holds(stored.snapshot))
195 return stored.answer
196 }
197
198 set(key: string, answer: unknown, snapshot: string): void {
199 this.write(`a-${key}`, JSON.stringify({ snapshot, answer }))

Callers

nothing calls this directly

Calls 3

readMethod · 0.95
isHashFunction · 0.85
holdsFunction · 0.50

Tested by

no test coverage detected