MCPcopy Index your code
hub / github.com/Effect-TS/effect / contextPartial

Function contextPartial

packages/platform/src/OpenApi.ts:107–122  ·  view source on GitHub ↗
(tags: Tags)

Source from the content-addressed store, hash-verified

105>() {}
106
107const contextPartial = <Tags extends Record<string, Context.Tag<any, any>>>(tags: Tags): (
108 options: {
109 readonly [K in keyof Tags]?: Context.Tag.Service<Tags[K]> | undefined
110 }
111) => Context.Context<never> => {
112 const entries = Object.entries(tags)
113 return (options) => {
114 let context = Context.empty()
115 for (const [key, tag] of entries) {
116 if (options[key] !== undefined) {
117 context = Context.add(context, tag, options[key]!)
118 }
119 }
120 return context
121 }
122}
123
124/**
125 * @since 1.0.0

Callers 1

OpenApi.tsFile · 0.85

Calls 2

entriesMethod · 0.80
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…