MCPcopy Create free account
hub / github.com/Packstack-Tech/packstack / searchItems

Function searchItems

frontend/src/lib/utils/search.ts:3–16  ·  view source on GitHub ↗
(items: any, searchText: string)

Source from the content-addressed store, hash-verified

1import Fuse from 'fuse.js';
2
3export 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}

Callers 2

renderInventoryFunction · 0.90
renderTablesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected