TarekRaafat / autoComplete.js

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

No handlings exists for JSON keys having spaces #167

Closed caycaycarly closed 3 years ago

caycaycarly commented 3 years ago

The demo instance fails with the first key/value pair in the .json file changed to "fo od": "Sauce - Thousand Island", (Notice the space in the key). The browser console outputs the following error autoComplete.min.js:1 Uncaught (in promise) TypeError: Cannot read property 'toString' of undefined at this line - var t = (e ? i[e] : i).toString(); in autoComplete.min.js

caycaycarly commented 3 years ago

I have removed the spaces from the keys as well, but I still run into the same issue.

[{
        "SundryDebtors": "Debtor A"
    },
    {
        "SundryDebtors": "Debtor B"
    },
    {
        "SundryDebtors": "Debtor C"
    },
    {
        "FixedAssets": "Land A"
    },
    {
        "FixedAssets": "Land B"
    },
    {
        "FixedAssets": "Land C"
    },
    {
        "CurrentLiabilities": "Liability X"
    }
]

I've used this as my .json data

caycaycarly commented 3 years ago

My bad.