(argConfig, config, value, index)
| 665 | * @returns {LocalProblem | null} a problem if any |
| 666 | */ |
| 667 | const processArgumentConfig = (argConfig, config, value, index) => { |
| 668 | if (index !== undefined && !argConfig.multiple) { |
| 669 | return { |
| 670 | type: "multiple-values-unexpected", |
| 671 | path: argConfig.path |
| 672 | }; |
| 673 | } |
| 674 | const parsed = parseValueForArgumentConfig(argConfig, value); |
| 675 | if (parsed === undefined) { |
| 676 | return { |
| 677 | type: "invalid-value", |
| 678 | path: argConfig.path, |
| 679 | expected: getExpectedValue(argConfig) |
| 680 | }; |
| 681 | } |
| 682 | const problem = setValue(config, argConfig.path, parsed, index); |
| 683 | if (problem) return problem; |
| 684 | return null; |
| 685 | }; |
| 686 | |
| 687 | /** |
| 688 | * Gets expected value. |
no test coverage detected