Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

[added] optional custom function to compare input value to list option values #294

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HUSSTECH
Copy link

@HUSSTECH HUSSTECH commented Nov 9, 2017

fixes #239, #266

Allows us to specify a custom comparison function to evaluate matches. In the same way the flexibility is provided to fully control the options list via your own code/logic, it would be good to be able to do the same for highlight matches. The issues above where users would like to check for string contains raher than startsWith will be able to do something like the following:

valueItemComparison={(optionItemValue, inputValue) => {  
            return optionItemValue.toLowerCase().includes(inputValue.toLowerCase())  
          }} 

This is a backwards compatible change, if the prop is not specified, then the old comparison logic using indexOf() is the default.

Possible improvements:

  1. naming of the comparison function and its input variables (a minor point, but I don't think they fit with the rest of the libs naming style)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autoHighlight is not always highlighting the top match
1 participant