jeancroy / FuzzySearch

:mag: Fast autocomplete suggestion engine using approximate string matching
MIT License
194 stars 32 forks source link

Cannot read property 'toString' of null #18

Closed Hasan-git closed 5 years ago

Hasan-git commented 5 years ago

@jeancroy Thank you for this wonderful library!!! indeed, It's a buried treasure just need some attention.

I have experienced some issues when a property is null

image

jeancroy commented 5 years ago

Thanks for the support ! So the desired behavior is skip indexing of this field on this object ?

Hasan-git commented 5 years ago

For me, I just fixed it for now by checking if value is null then push an empty string ! else list.push(obj.toString()); -> else list.push(obj != null ? obj.toString() : ''); actually, I don't know if its the best solution, but I need a fast solution while null values are so common in my case.

jeancroy commented 5 years ago

Hi, I just pushed something that I think address your issue.

https://github.com/jeancroy/FuzzySearch/commit/cbcdd8307d70a209b1cbf17a535158d5c21840d7

Hasan-git commented 5 years ago

Great job !!