API Reference
normalizeArrayInput
Normalizes array inputs that may contain comma-separated strings.
Handles both CLI arguments (which may pass comma-separated values as single strings) and config file arrays. Non-string values (e.g., numbers) pass through unchanged.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| `cliValue` | `Array.<(string|number)>` | Value from CLI arguments. |
| `configValue` | `Array.<(string|number)>` | Value from config file. |
| `defaultValue` | `Array.<(string|number)>` | Default value if both are undefined. |
### Returns
**Type:** `Array.<(string|number)>`
- Normalized array of values.
### Examples
```javascript
// CLI passes "id1,id2" as single array element
normalizeArrayInput(['id1,id2'], undefined, []) // Returns: ['id1', 'id2'] javascript // Config has proper array, CLI is undefined normalizeArrayInput(undefined, ['id1', 'id2'], []) // Returns: ['id1', 'id2'] javascript // Mixed: some elements have commas, some don't normalizeArrayInput(['id1,id2', 'id3'], undefined, []) // Returns: ['id1', 'id2', 'id3'] javascript // Numeric IDs pass through unchanged normalizeArrayInput([123, 456], undefined, []) // Returns: [123, 456] ```
normalizeFiletypes
Normalizes file type inputs with a specific default.
File types don't need the Boolean filter since empty strings are valid defaults.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| `cliValue` | `Array` | Value from CLI arguments. |
| `configValue` | `Array` | Value from config file. |
### Returns
**Type:** `Array.<string>`
- Normalized array of file types.
### Examples
```javascript
// Default file types when nothing specified
normalizeFiletypes(undefined, undefined) // Returns: ['bam', 'bam.bai'] ```
normalizeStringOption
Normalizes a CLI option that should be a string but may be an array
due to duplicate command-line arguments. When the same option is specified multiple times (e.g., `-c file1.json -c file2.json`), yargs creates an array. This function takes the last value, following the convention that the last specified option wins.
### Parameters
| Name | Type | Description |
|------|------|-------------|
| `value` | `string` | The CLI option value. |
### Returns
**Type:** `string`
- The normalized string value.
### Examples
```javascript
// Single value passes through unchanged
normalizeStringOption('config.json') // Returns: 'config.json' javascript // Array returns last element (last specified wins) normalizeStringOption(['first.json', 'second.json']) // Returns: 'second.json' javascript // Undefined passes through unchanged normalizeStringOption(undefined) // Returns: undefined ```
