Skip to content
Discussion options

You must be logged in to vote

Hey, sorry for the late reply.

I've added a static Fuse.match() method that does exactly this — matches a pattern against a single string without needing to construct a full Fuse instance:

import Fuse from 'fuse.js'

const { isMatch, score } = Fuse.match('apple', 'Paul likes apples')
// { isMatch: true, score: 0.11 }

// With options
Fuse.match('apple', 'apple pie', { includeMatches: true })
// { isMatch: true, score: 0, indices: [[0, 4]] }

All the usual options (threshold, isCaseSensitive, minMatchCharLength, etc.) are supported.

This is now on main.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by krisk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants