(rawOptions)
| 28 | * 规范化选项列表 |
| 29 | */ |
| 30 | export const normalizeOptions = (rawOptions) => { |
| 31 | if (!Array.isArray(rawOptions)) return [] |
| 32 | |
| 33 | return rawOptions |
| 34 | .map((item) => { |
| 35 | if (item && typeof item === 'object') { |
| 36 | const label = String(item.label || item.value || '').trim() |
| 37 | const value = String(item.value || item.label || '').trim() |
| 38 | return label && value ? { label, value } : null |
| 39 | } |
| 40 | |
| 41 | const text = String(item || '').trim() |
| 42 | return text ? { label: text, value: text } : null |
| 43 | }) |
| 44 | .filter(Boolean) |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * 规范化问题列表 |
no outgoing calls
no test coverage detected