MCPcopy Create free account
hub / github.com/LeetCode-OpenSource/ayanami / createOrGetInstanceInScope

Function createOrGetInstanceInScope

src/core/scope/utils.ts:21–25  ·  view source on GitHub ↗
(constructor: ConstructorOf<T>, scope: Scope)

Source from the content-addressed store, hash-verified

19export const ayanamiInstances: Map<Scope, Instance[]> = new Map()
20
21export function createOrGetInstanceInScope<T>(constructor: ConstructorOf<T>, scope: Scope): T {
22 const instanceAtScope = getInstanceFrom(constructor, scope)
23
24 return instanceAtScope ? instanceAtScope : createInstanceInScope(constructor, scope)
25}
26
27function createInstanceInScope<T>(constructor: ConstructorOf<T>, scope: Scope): T {
28 const paramTypes: ConstructorOf<any>[] =

Callers 4

getInstanceWithScopeFunction · 0.90
scope.spec.tsFile · 0.90
emitSSREffectsFunction · 0.90
createInstanceInScopeFunction · 0.85

Calls 2

getInstanceFromFunction · 0.85
createInstanceInScopeFunction · 0.85

Tested by

no test coverage detected