| 17037 | // ----------------------------------------------------------------------------- |
| 17038 | |
| 17039 | const semVerStringTransformation = <A>( |
| 17040 | parse: (input: string) => Result_.Result<A, SemVer_.SemVerError>, |
| 17041 | format: (value: A) => string |
| 17042 | ): SchemaTransformation.Transformation<A, string> => |
| 17043 | SchemaTransformation.transformEffect({ |
| 17044 | decode: (input, options) => |
| 17045 | Effect.mapErrorEager( |
| 17046 | Effect.fromResult(parse(input)), |
| 17047 | (error) => new SchemaIssue.InvalidValue({ message: error.message }, input, options) |
| 17048 | ), |
| 17049 | encode: (value) => Effect.succeed(format(value)) |
| 17050 | }) |
| 17051 | // Alphanumeric identifiers contain at least one non-digit. |
| 17052 | const SemVerCoreArbitrary = Struct({ |
| 17053 | major: Natural, |