( option: Option.Option<string>, typeName: string, parse: (value: string) => Effect.Effect<A, E> )
| 479 | } |
| 480 | |
| 481 | const attempt = <E, A>( |
| 482 | option: Option.Option<string>, |
| 483 | typeName: string, |
| 484 | parse: (value: string) => Effect.Effect<A, E> |
| 485 | ): Effect.Effect<A, string> => |
| 486 | Effect.orElseFail( |
| 487 | option, |
| 488 | () => `${typeName} options do not have a default value` |
| 489 | ).pipe( |
| 490 | Effect.flatMap((value) => |
| 491 | Effect.orElseFail( |
| 492 | parse(value), |
| 493 | () => `'${value}' is not a ${typeName}` |
| 494 | ) |
| 495 | ) |
| 496 | ) |
| 497 | |
| 498 | const validatePathExistence = ( |
| 499 | path: string, |
no test coverage detected