huntabyte / cmdk-sv

cmdk, but for Svelte ✨
https://cmdk-sv.com
MIT License
424 stars 18 forks source link

Feature: export `defaultFilter` function #28

Closed Not-Jayden closed 8 months ago

Not-Jayden commented 8 months ago

It would be convenient to export the defaultFilter function default, given it's already included in the package.

For context, I've ended up using a delimeter with a generated ID for the value prop of everywhere I've used Command.Item (e.g. Untitled file|329fbkjh3e), as a means of ensuring the selected value will be unique when there are items with duplicate names.

This however results in the need to use a custom filter to split the actual value from the delimiter and filter without the generated ID.

I'm quite happy with the default command-score fuzzy matching logic, so I would rather not have to revert to either a more primitive .includes() check or installing another fuzzy matching library.