(value: EffortValue)
| 223 | } |
| 224 | |
| 225 | export function convertEffortValueToLevel(value: EffortValue): EffortLevel { |
| 226 | if (typeof value === 'string') { |
| 227 | // Runtime guard: value may come from remote config (GrowthBook) where |
| 228 | // TypeScript types can't help us. Coerce unknown strings to 'high' |
| 229 | // rather than passing them through unchecked. |
| 230 | return isEffortLevel(value) ? value : 'high' |
| 231 | } |
| 232 | if (isInternalBuild() && typeof value === 'number') { |
| 233 | if (value <= 50) return 'low' |
| 234 | if (value <= 85) return 'medium' |
| 235 | if (value <= 100) return 'high' |
| 236 | return 'max' |
| 237 | } |
| 238 | return 'high' |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Get user-facing description for effort levels |
no test coverage detected