Function
fitVariant
(value: string | undefined, variants: string[])
Source from the content-addressed store, hash-verified
| 80 | } |
| 81 | |
| 82 | function fitVariant(value: string | undefined, variants: string[]): string | undefined { |
| 83 | if (!value) { |
| 84 | return undefined |
| 85 | } |
| 86 | |
| 87 | if (variants.length === 0 || variants.includes(value)) { |
| 88 | return value |
| 89 | } |
| 90 | |
| 91 | return undefined |
| 92 | } |
| 93 | |
| 94 | // Picks the active variant. CLI flag wins, then saved preference, then session |
| 95 | // history. fitVariant() checks saved and session values against the available |
Tested by
no test coverage detected