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

Function pick

packages/effect/src/internal/context.ts:313–325  ·  view source on GitHub ↗
(...tags: Tags)

Source from the content-addressed store, hash-verified

311/** @internal */
312export const pick =
313 <Tags extends ReadonlyArray<C.Tag<any, any>>>(...tags: Tags) =>
314 <Services>(self: C.Context<Services>): C.Context<
315 Services & C.Tag.Identifier<Tags[number]>
316 > => {
317 const tagSet = new Set<string>(tags.map((_) => _.key))
318 const newEnv = new Map()
319 for (const [tag, s] of self.unsafeMap.entries()) {
320 if (tagSet.has(tag)) {
321 newEnv.set(tag, s)
322 }
323 }
324 return makeContext(newEnv)
325 }
326
327/** @internal */
328export const omit =

Callers

nothing calls this directly

Calls 4

makeContextFunction · 0.85
entriesMethod · 0.80
mapMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected