(items: any, searchText: string)
| 1 | import Fuse from 'fuse.js'; |
| 2 | |
| 3 | export function searchItems(items: any, searchText: string) { |
| 4 | const fuse = new Fuse(items, { |
| 5 | threshold: 0.25, |
| 6 | location: 0, |
| 7 | distance: 4, |
| 8 | maxPatternLength: 32, |
| 9 | minMatchCharLength: 2, |
| 10 | keys: [ |
| 11 | "name", |
| 12 | "product_name" |
| 13 | ] |
| 14 | }); |
| 15 | return !!searchText ? fuse.search(searchText) : items; |
| 16 | } |
no outgoing calls
no test coverage detected