(searchText: string, option: Option<T>)
| 19 | } |
| 20 | |
| 21 | function getFilteredOption<T>(searchText: string, option: Option<T>): boolean { |
| 22 | if (!searchText) { |
| 23 | return true; |
| 24 | } |
| 25 | const label = (option.label ?? String(option.value ?? '')).toLowerCase(); |
| 26 | const hint = (option.hint ?? '').toLowerCase(); |
| 27 | const value = String(option.value).toLowerCase(); |
| 28 | const term = searchText.toLowerCase(); |
| 29 | |
| 30 | return label.includes(term) || hint.includes(term) || value.includes(term); |
| 31 | } |
| 32 | |
| 33 | function getSelectedOptions<T>(values: T[], options: Option<T>[]): Option<T>[] { |
| 34 | const results: Option<T>[] = []; |
no outgoing calls
no test coverage detected