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

Function argsEncoder

packages/effect/src/ui/Query.ts:2512–2518  ·  view source on GitHub ↗
(ast: SchemaAST.AST)

Source from the content-addressed store, hash-verified

2510 * `undefined` properties of an args struct are dropped.
2511 */
2512const argsEncoder = (ast: SchemaAST.AST): (args: unknown) => unknown => {
2513 const encode = Schema.encodeUnknownSync(
2514 Schema.toCodecJson(Schema.make<Schema.Codec<unknown, unknown>>(ast))
2515 )
2516 const drop = dropUndefinedOf(ast)
2517 return drop === null ? encode : (args) => encode(drop(args))
2518}
2519
2520// -----------------------------------------------------------------------------
2521// Host signals

Callers 1

makeDefFunction · 0.85

Calls 5

dropUndefinedOfFunction · 0.85
encodeFunction · 0.70
toCodecJsonMethod · 0.65
makeMethod · 0.65
dropFunction · 0.50

Tested by

no test coverage detected