MCPcopy Create free account
hub / github.com/Effect-TS/effect / lookup

Function lookup

packages/effect/src/Context.ts:594–599  ·  view source on GitHub ↗
(self: Context<Services>, key: string)

Source from the content-addressed store, hash-verified

592
593// Read fields rather than dispatching through a method for contexts from other copies of effect.
594const lookup = <Services>(self: Context<Services>, key: string): unknown => {
595 const impl = self as ContextImpl<Services>
596 if (impl.overlay !== undefined) return overlayLookup(impl, key)
597 const value = impl.base.get(key)
598 return value === undefined && !impl.base.has(key) ? notFound : value
599}
600
601const overlayLookup = (self: ContextImpl<any>, key: string): unknown => {
602 for (let overlay = self.overlay; overlay; overlay = overlay.parent) {

Callers 6

LayerMap.tsFile · 0.70
makeWithFunction · 0.70
Context.tsFile · 0.70
getOrUndefinedUnsafeFunction · 0.70
getReferenceUnsafeFunction · 0.70
pickFunction · 0.70

Calls 3

overlayLookupFunction · 0.85
getMethod · 0.65
hasMethod · 0.65

Tested by

no test coverage detected