(
encode: (
effect: Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, S["EncodingServices"]>,
options: SchemaAST.ParseOptions
) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, RE>
)
| 5372 | * @since 4.0.0 |
| 5373 | */ |
| 5374 | export function middlewareEncoding<S extends Constraint, RE>( |
| 5375 | encode: ( |
| 5376 | effect: Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, S["EncodingServices"]>, |
| 5377 | options: SchemaAST.ParseOptions |
| 5378 | ) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, RE> |
| 5379 | ) { |
| 5380 | return (schema: S): middlewareEncoding<S, RE> => |
| 5381 | make( |
| 5382 | SchemaAST.middlewareEncoding(schema.ast, new SchemaTransformation.Middleware(identity, encode)), |
| 5383 | { schema } |
| 5384 | ) |
| 5385 | } |
| 5386 | |
| 5387 | /** |
| 5388 | * Recovers from a decoding error by providing a fallback value. |
no test coverage detected