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

Function getDefaultValue

packages/effect/src/internal/context.ts:230–237  ·  view source on GitHub ↗
(tag: C.Reference<any, any>)

Source from the content-addressed store, hash-verified

228
229const defaultValueCache = globalValue("effect/Context/defaultValueCache", () => new Map<string, any>())
230const getDefaultValue = (tag: C.Reference<any, any>) => {
231 if (defaultValueCache.has(tag.key)) {
232 return defaultValueCache.get(tag.key)
233 }
234 const value = tag.defaultValue()
235 defaultValueCache.set(tag.key, value)
236 return value
237}
238
239/** @internal */
240export const unsafeGetReference = <Services, I, S>(self: C.Context<Services>, tag: C.Reference<I, S>): S => {

Callers 2

unsafeGetReferenceFunction · 0.85
context.tsFile · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected