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

Function go

packages/effect/src/SchemaAST.ts:1935–1951  ·  view source on GitHub ↗
(parameter: AST)

Source from the content-addressed store, hash-verified

1933 let symbolKeys: ReadonlyArray<symbol> | undefined
1934
1935 function go(parameter: AST): ReadonlyArray<PropertyKey> {
1936 switch (parameter._tag) {
1937 case "String":
1938 case "TemplateLiteral":
1939 return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchPart(k, options) !== undefined)
1940 case "Number":
1941 return (stringKeys ??= Object.keys(input)).filter((k) => parameter.matchKey(k, options) !== undefined)
1942 case "Symbol":
1943 return (symbolKeys ??= Object.getOwnPropertySymbols(input)).filter((k) =>
1944 parameter.matchKey(k, options) !== undefined
1945 )
1946 case "Union":
1947 return [...new Set(parameter.types.flatMap(go))]
1948 default:
1949 return []
1950 }
1951 }
1952 return go(parameterFromPropertyKey(toEncoded(parameter)))
1953}
1954

Callers 3

getIndexSignatureKeysFunction · 0.70
parseParameterFunction · 0.70

Calls 6

filterMethod · 0.80
pushMethod · 0.80
addMethod · 0.65
matchPartMethod · 0.45
matchKeyMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected