Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: export defaultFilter #229

Merged
merged 1 commit into from
Mar 8, 2024
Merged

Conversation

evanob
Copy link
Contributor

@evanob evanob commented Mar 8, 2024

Exporting the defaultFilter would allow users to re-use the internal command-score implementation with their own wrapping function. For example, we might want to transform one or more of the arguments before calling it.

import { Command, defaultFilter } from 'cmdk'

<Command 
  filter={(value, search, keywords) => 
    defaultFilter(value, search.replaceAll(' ', ''), keywords)
  }
>
  ...
</Command>

Copy link

vercel bot commented Mar 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
cmdk-website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 8, 2024 1:37pm

@pacocoursey pacocoursey merged commit e4dcd16 into pacocoursey:main Mar 8, 2024
1 check passed
@e1himself
Copy link

Hi!
Is it planned to release this soon-ish?
Thanks!

@torickjdavis
Copy link

torickjdavis commented Aug 29, 2024

When released, this will probably close #197; although, there's probably a bit more discussion to be had regarding:

Agreed, I'll add an export for the defaultFilter. A future version may not ship with a default filter at all, to reduce bundle size.
(Original Comment)

@andriijas
Copy link

@pacocoursey any update whatever this can reach a preview release soon or stable? Or if it will be removed as discussed to reduce bundle size?

@igor9silva
Copy link

igor9silva commented Feb 1, 2025

Hi everyone. You can import defaultFilter on package version 1.0.4.

If you previously installed this lib via shadcn/ui cli, it's likely set to 1.0.0 on you package.json, so you need to update to ^1.0.0 and then run bun update cmdk.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants