Closed urbanL1fe closed 4 years ago
I had made a minor change locally in the command to pass the regex expression object itself. commandToRegExp() is only called if command is not IsRegEx().
👏 Excellent change! Yes, this is exactly what I had in mind.
One request before we merge this: can you document this new feature in the Commands section of the README? It doesn't need to be perfect - I can tweak the README after merging this PR if needed. A few things worth emphasising in the README:
isFuzzyMatch
turned onSince english is not my native language there may be some errors. Your advice about what i need to emphasise help a lot though.
It was interesting for sure. If it needs any changes or you have any new features in mind i ll be happy to contribute
@urbanL1fe Fuzzy matching is now live on npm in version 3.1.0
…mands API
I implemented the fuzzy matching within the commands api as discussed in this pull request.
I wondered how to handle the cases where
isFuzzyMatch
istrue
but the api user passes a regex or a string with special characters as the command. At first, for the 'string with special characters' case i thought that we should maybe do a fuzzy match check against the predefined or the variable part of the command but both seemed confusing for the user and probably not really helpful. Then i tried to decide the way that we will ignore these cases and i chose to convert regex to string and string with special characters to string without them. The other way to handle these would probably be to act likeisFuzzyMatch
isfalse
for these cases but i decided against because the user has explicitly set it totrue
.Is that what you had in mind? I am open, of course, for changes and proposals.