mattyork / fuzzy

Filters a list based on a fuzzy string search
MIT License
831 stars 86 forks source link

Add error handling and fallback for .filter #13

Closed danielravina closed 8 years ago

danielravina commented 8 years ago

I use fuzzy on a backend project where the pattern and the arr are sometimes undefined or empty. Thought it'll be good to have some error handling and fallbacks. Without it, when you pass undefined, it breaks:

# When pattern is undefined
TypeError: Cannot read property 'toLowerCase' of undefined`
# When arr is undefined
TypeError: Cannot read property 'reduce' of undefined
mattyork commented 8 years ago

Awesome! Thanks for the PR

danielravina commented 8 years ago

all fixed! :+1:

danielravina commented 8 years ago

Thanks. Any eta for release on npm?