MCPcopy Create free account
hub / github.com/effect-app/libs / f

Function f

packages/effect-app/src/utils.ts:541–552  ·  view source on GitHub ↗
(target: T)

Source from the content-addressed store, hash-verified

539export function lazyGetter<T extends object, T2>(creator: (target: T) => T2) {
540 const key = Symbol(creator.name)
541 const f = (target: T): T2 => {
542 let lazy = (target as unknown as Lazy)[LazySymbol]
543 if (!lazy) {
544 lazy = {}
545 Object.defineProperty(target, LazySymbol, { enumerable: false, value: lazy })
546 } else if (lazy[key]) {
547 return lazy[key]
548 }
549 const value = creator(target)
550 lazy[key] = value
551 return value
552 }
553 Object.defineProperty(f, "name", {
554 enumerable: false,
555 value: `Lazy<${creator.name}>`

Callers 15

tupleTapFunction · 0.70
ifDiff_Function · 0.70
catchAllMapFunction · 0.70
Array.tsFile · 0.70
filterWithFunction · 0.70
tupledCurryFunction · 0.70
reverseCurryFunction · 0.70
curryFunction · 0.70
uncurryFunction · 0.70
lazyFunction · 0.70
utils.tsFile · 0.70
partialFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected