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

Function semVerStringTransformation

packages/effect/src/Schema.ts:17039–17050  ·  view source on GitHub ↗
(
  parse: (input: string) => Result_.Result<A, SemVer_.SemVerError>,
  format: (value: A) => string
)

Source from the content-addressed store, hash-verified

17037// -----------------------------------------------------------------------------
17038
17039const 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.
17052const SemVerCoreArbitrary = Struct({
17053 major: Natural,

Callers 1

Schema.tsFile · 0.85

Calls 3

formatFunction · 0.90
parseFunction · 0.70
succeedMethod · 0.45

Tested by

no test coverage detected