mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
feat: build
This commit is contained in:
8
src/utils/lazySchema.ts
Normal file
8
src/utils/lazySchema.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Returns a memoized factory function that constructs the value on first call.
|
||||
* Used to defer Zod schema construction from module init time to first access.
|
||||
*/
|
||||
export function lazySchema<T>(factory: () => T): () => T {
|
||||
let cached: T | undefined
|
||||
return () => (cached ??= factory())
|
||||
}
|
||||
Reference in New Issue
Block a user