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

Function parseParameter

packages/effect/src/SchemaAST.ts:3587–3616  ·  view source on GitHub ↗
(ast: AST)

Source from the content-addressed store, hash-verified

3585}
3586
3587function parseParameter(ast: AST): {
3588 literals: ReadonlyArray<PropertyKey>
3589 parameters: ReadonlyArray<AST>
3590} {
3591 const literals: Array<PropertyKey> = []
3592 const parameters: Array<AST> = []
3593 function go(ast: AST) {
3594 switch (ast._tag) {
3595 case "Literal":
3596 if (Predicate.isPropertyKey(ast.literal)) {
3597 literals.push(ast.literal)
3598 }
3599 return
3600 case "UniqueSymbol":
3601 literals.push(ast.symbol)
3602 return
3603 case "Never":
3604 return
3605 case "Union":
3606 for (let i = 0; i < ast.types.length; i++) {
3607 go(ast.types[i])
3608 }
3609 return
3610 default:
3611 parameters.push(ast)
3612 }
3613 }
3614 go(ast)
3615 return { literals, parameters }
3616}
3617
3618/** @internal */
3619export function record(key: AST, value: AST): Objects {

Callers 1

recordFunction · 0.85

Calls 1

goFunction · 0.70

Tested by

no test coverage detected