TarekRaafat / autoComplete.js

Simple autocomplete pure vanilla Javascript library.
https://tarekraafat.github.io/autoComplete.js
Apache License 2.0
3.93k stars 236 forks source link

Undefinied element on list #398

Open Marcif opened 1 year ago

Marcif commented 1 year ago

I'm having an issue with an undefined item in a drop-down list when I click on input. Could you please help me

obraz

Source code on CodePen: https://codepen.io/marcif/pen/WNKVBYL

folknor commented 1 year ago

Works fine for me, both in Firefox and Chrome on Linux.

EDIT: I just opened your codepen and clicked the text input. Looks the same in both browsers.

nobug

Marcif commented 1 year ago

I find solution. Modify filter from this:

filter: (list) => { let filteredResults = Array.from( new Set(list.map((value) => value.match)) ).map((food) => { return list.find((value) => value.match === food); }); return filteredResults; }

to this:

filter: list => list.filter(item => item.key in item.value),

and now works fine