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

Function enumerateChildren

packages/effect/src/internal/configProvider.ts:129–147  ·  view source on GitHub ↗
(
    path: ReadonlyArray<string>
  )

Source from the content-addressed store, hash-verified

127 }
128
129 const enumerateChildren = (
130 path: ReadonlyArray<string>
131 ): Effect.Effect<HashSet.HashSet<string>, ConfigError.ConfigError> =>
132 core.sync(() => {
133 const current = getEnv()
134 const keys = Object.keys(current)
135 const keyPaths = keys.map((value) => unmakePathString(value.toUpperCase()))
136 const filteredKeyPaths = keyPaths.filter((keyPath) => {
137 for (let i = 0; i < path.length; i++) {
138 const pathComponent = pipe(path, Arr.unsafeGet(i))
139 const currentElement = keyPath[i]
140 if (currentElement === undefined || pathComponent !== currentElement) {
141 return false
142 }
143 }
144 return true
145 }).flatMap((keyPath) => keyPath.slice(path.length, path.length + 1))
146 return HashSet.fromIterable(filteredKeyPaths)
147 })
148
149 return fromFlat(makeFlat({ load, enumerateChildren, patch: pathPatch.empty }))
150}

Callers

nothing calls this directly

Calls 7

getEnvFunction · 0.85
unmakePathStringFunction · 0.85
syncMethod · 0.80
keysMethod · 0.80
unsafeGetMethod · 0.80
pipeFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected