mattyork / fuzzy

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

Startswith #14

Open DomSavd opened 8 years ago

DomSavd commented 8 years ago

Hi,

Is it possible to match an exact text? For example, i want to retrieve the results for all value that as "thisvalue" but not the other resultats that contain these letter for example "this poor value".

Thanks!

wuyuanyi135 commented 8 years ago

+1 I hope there is an adjustable parameter to define the fuzziness.

wych42 commented 8 years ago

+1

mattyork commented 8 years ago

Can you folks provide some examples you'd like to see implemented so I have a better understanding of what knobs to provide?

To get exact startsWith behavior, there is no need for this library. You can define your own function:

var filter = (arr, searchTerm) => arr.filter(str => str.indexOf(searchTerm) === 0);
filter(["abc", "zabc"], "ab")
// ["abc"]