( self: Param<Kind, A>, options?: VariadicParamOptions | undefined )
| 1512 | * @since 4.0.0 |
| 1513 | */ |
| 1514 | export const variadic = <Kind extends ParamKind, A>( |
| 1515 | self: Param<Kind, A>, |
| 1516 | options?: VariadicParamOptions | undefined |
| 1517 | ): Param<Kind, ReadonlyArray<A>> => { |
| 1518 | const single = getUnderlyingSingleOrThrow(self) |
| 1519 | const parse: Parse<ReadonlyArray<A>> = (args) => { |
| 1520 | if (single.kind === "argument") { |
| 1521 | return parsePositionalVariadic(self, single, args, options) |
| 1522 | } else { |
| 1523 | return parseOptionVariadic(self, single, args, options) |
| 1524 | } |
| 1525 | } |
| 1526 | return Object.assign(Object.create(Proto), { |
| 1527 | _tag: "Variadic", |
| 1528 | kind: self.kind, |
| 1529 | param: self, |
| 1530 | min: Option.fromUndefinedOr(options?.min), |
| 1531 | max: Option.fromUndefinedOr(options?.max), |
| 1532 | parse |
| 1533 | }) |
| 1534 | } |
| 1535 | |
| 1536 | /** |
| 1537 | * Wraps an option to allow it to be specified multiple times within a range. |
no test coverage detected