Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/arctic-cli/interface
/ lazy
Function
lazy
packages/util/src/lazy.ts:1–11 ·
view source on GitHub ↗
(fn: () => T)
Source
from the content-addressed store, hash-verified
1
export
function
lazy<T>(fn: () => T) {
2
let
value: T | undefined
3
let
loaded = false
4
5
return
(): T => {
6
if
(loaded)
return
value as T
7
loaded = true
8
value = fn()
9
return
value as T
10
}
11
}
Callers
nothing calls this directly
Calls
1
fn
Function · 0.70
Tested by
no test coverage detected