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

Function configPathToString

packages/effect/src/internal/configProvider.ts:731–753  ·  view source on GitHub ↗
(path: ReadonlyArray<KeyComponent>)

Source from the content-addressed store, hash-verified

729}
730
731const configPathToString = (path: ReadonlyArray<KeyComponent>): ReadonlyArray<string> => {
732 const output: Array<string> = []
733 let i = 0
734 while (i < path.length) {
735 const component = path[i]
736 if (component._tag === "KeyName") {
737 if (i + 1 < path.length) {
738 const nextComponent = path[i + 1]
739 if (nextComponent._tag === "KeyIndex") {
740 output.push(`${component.name}[${nextComponent.index}]`)
741 i += 2
742 } else {
743 output.push(component.name)
744 i += 1
745 }
746 } else {
747 output.push(component.name)
748 i += 1
749 }
750 }
751 }
752 return output
753}
754
755const getIndexedEntries = (
756 config: JsonMap

Callers 1

fromJsonFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected