Closed justinireland closed 8 years ago
All javascript strings should have the toLowerCase()
method. Maybe React Native wraps string inputs in some other object? Does calling toString()
on the input string fix the problem? i.e. fuzzy.filter(stringInput.toString(), list)
. I can't reproduce this in a non React Native environment and I don't plan to set up a React Native environment, but will happily make a fix if we find one.
toString() makes no difference and I can confirm that the input is typeof string.
Also, I am searching an array of objects (with only text fields) if that makes any difference.
@justinireland what exactly do you mean by an array of objects with only text fields?
If your array is like this:
var arr = [{textField: 'a'}, {textField: 'b'}]
Then fuzzy won't know to extract textField
from each object unless you tell it to:
fuzzy.filter('a', arr, { extract: obj => obj.textField });
Ok, that was part of the problem. I was not properly extracting the field I needed from the array objects.
I'm reopening a new issue relating to issue #27 since it was closed prematurely.