I’m trying to understand how to make a dropdown search function in javscript that works like file-search CTRL+P
in vscode.
The search query to be automatically including wildcards.
For example i type inds
and vscode finds index.js file.
How to make something similar in javscript using indexOf
for example?
Thank you
Advertisement
Answer
What you are looking for is called fuzzy finders. You can find a lot of packages out there just by googling it.
Fuzzy searching allows for flexibly matching a string with partial input, useful for filtering data very quickly based on lightweight user input.
E.g:
- Fuse.js
- Fuzzysearch
- etc