Customization
Customizing the behavior of the library.
Fuzzy List Options
To customize the search behavior, provide an options object with the following parameters:
key and getKey
If the dataset consists of objects, use key or getKey to specify which properties to search in.
Similarly, getKey allows searching across multiple or nested properties.
limit Option
Limits the number of search results returned. Useful for optimizing UI rendering.
The result set will contain a maximum of 5 items.
maxScore Option
Filters results by score, which represents the distance from an exact match.
Sorting Behavior
When using both limit and maxScore, results are first filtered by score, then truncated to the limit.
debug Option
Enables logging of search execution details in the console.
mapResult Option
Transforms result items before returning them.
TypeScript Generics
The library uses two generics: one for input type (list items) and another for output type (result items). If mapResult is used, the output type adapts accordingly.
Last updated on