MCPcopy Create free account
hub / github.com/chakra-ui/panda / getOrInsertComputed

Method getOrInsertComputed

packages/shared/src/cache-map.ts:93–101  ·  view source on GitHub ↗
(key: K, callback: (key: K) => V)

Source from the content-addressed store, hash-verified

91 }
92
93 getOrInsertComputed(key: K, callback: (key: K) => V): V {
94 if (this.cache.has(key)) {
95 this.updateKeyUsage(key)
96 return this.cache.get(key)!
97 }
98 const value = callback(key)
99 this.set(key, value)
100 return value
101 }
102
103 [Symbol.iterator]() {
104 return this.cache[Symbol.iterator]()

Callers

nothing calls this directly

Calls 5

updateKeyUsageMethod · 0.95
setMethod · 0.95
callbackFunction · 0.85
hasMethod · 0.80
getMethod · 0.80

Tested by

no test coverage detected