Merge pull request #1378 from umap-project/filter-with-non-str

Fix filter data crashing when data contains non string values
This commit is contained in:
Yohan Boniface 2023-10-26 19:23:01 +02:00 committed by GitHub
commit 3fc5a63910
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -478,8 +478,9 @@ L.U.FeatureMixin = {
matchFilter: function (filter, keys) {
filter = filter.toLowerCase()
for (let i = 0; i < keys.length; i++) {
if ((this.properties[keys[i]] || '').toLowerCase().indexOf(filter) !== -1)
for (let i = 0, value; i < keys.length; i++) {
value = (this.properties[keys[i]] || '') + ''
if (value.toLowerCase().indexOf(filter) !== -1)
return true
}
return false