cmdk
cmdk copied to clipboard
Export of commandScore?
Would you consider exporting commandScore? I like the default commandScore, but it would be great to reuse it.
Why?
My first use case is that I have added some unique value to my command items to avoid name clash issues that interfere with the search like suggested here https://github.com/pacocoursey/cmdk/issues/174
<Command.Item value="apple __a__">Apple</Command.Item>
<Command.Item value="apple __b__">Apple</Command.Item>
so something like this would do the trick
filter={(value: string, search: string, keywords?: string[]) => {
// value: `<name> __${unique}__)`
const valueWithoutUnique = value.replace(/\s+__\s+__/, "");
return commandScore(valueWithoutUnique, search, keywords);
}}
or another use case would be to change filter only for some specific keyword and for others leave the default.