mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-01 06:42:26 +00:00
Refactor external tools organization and add file search API endpoint
🤖 Generated with [OpenCode](https://opencode.ai) Co-Authored-By: OpenCode <noreply@opencode.ai>
This commit is contained in:
11
packages/opencode/src/util/lazy.ts
Normal file
11
packages/opencode/src/util/lazy.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export function lazy<T>(fn: () => T) {
|
||||
let value: T | undefined
|
||||
let loaded = false
|
||||
|
||||
return (): T => {
|
||||
if (loaded) return value as T
|
||||
value = fn()
|
||||
return value as T
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user