refactor: rename shared package to core (#24309)
This commit is contained in:
parent
37aa8442dc
commit
62ef2a2207
166 changed files with 218 additions and 218 deletions
11
packages/core/src/util/lazy.ts
Normal file
11
packages/core/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
|
||||
loaded = true
|
||||
value = fn()
|
||||
return value as T
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue