( parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, R> )
| 969 | |
| 970 | /** @internal */ |
| 971 | export function asOption<T, E, R>( |
| 972 | parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, R> |
| 973 | ): (input: E, options?: SchemaAST.ParseOptions) => Option.Option<T> { |
| 974 | const parserExit = asExit(parser) |
| 975 | return (input: E, options?: SchemaAST.ParseOptions) => { |
| 976 | const exit = parserExit(input, options) |
| 977 | if (Exit.isSuccess(exit)) { |
| 978 | return Option.some(exit.value) |
| 979 | } |
| 980 | InternalSchemaCause.getSchemaIssueOrThrow(exit.cause, "Option adapter can only return none for schema issues") |
| 981 | return Option.none() |
| 982 | } |
| 983 | } |
| 984 | |
| 985 | function asResult<T, E, R>( |
| 986 | parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, R> |
no test coverage detected