MCPcopy Create free account
hub / github.com/effect-app/libs / transformSingle

Function transformSingle

repos/effect/packages/effect/src/unstable/cli/Param.ts:2038–2053  ·  view source on GitHub ↗
(
  param: Param<Kind, A>,
  f: <X>(single: Single<Kind, X>) => Single<Kind, X>
)

Source from the content-addressed store, hash-verified

2036) {
2037 const results: Array<A> = []
2038 const names = [single.name, ...single.aliases]
2039 const values = names.flatMap((name) => args.flags[name] ?? [])
2040 const count = values.length
2041
2042 // Validate count constraints
2043 if (Predicate.isNotUndefined(options?.min) && count < options.min) {
2044 return yield* count === 0
2045 ? new CliError.MissingOption({ option: single.name })
2046 : new CliError.InvalidValue({
2047 option: single.name,
2048 value: `${count} occurrences`,
2049 expected: `at least ${options.min} value${options.min === 1 ? "" : "s"}`,
2050 kind: single.kind
2051 })
2052 }
2053
2054 if (Predicate.isNotUndefined(options?.max) && count > options.max) {
2055 return yield* new CliError.InvalidValue({
2056 option: single.name,

Callers 2

Param.tsFile · 0.85
withHiddenFunction · 0.85

Calls 6

matchParamFunction · 0.85
variadicFunction · 0.85
transformFunction · 0.70
optionalFunction · 0.70
fFunction · 0.50
mapFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…