fuzzy
fuzzy copied to clipboard
fuzzy should accept number values
trafficstars
It's common to filter lists with mixed-type data. fuzzy currently throws an error if you pass it a number value.
One workaround is to convert numbers to strings before passing values to fuzzy. The downside to this approach is that you have to throw out (sometimes essential) type information about your data. Ideally, fuzzy would handle both strings and numbers internally, return values that preserve the original type.
Fix in Mapbox's fork: https://github.com/mapbox/fuzzy/pull/1 – @mattyork let me know if you'd like to have this – it introduces a breaking change: renames 'string' to 'val' in the returned objects.