Case agnostic search

This commit is contained in:
portree_kid 2020-01-10 15:35:39 +01:00
parent 67cca39c0b
commit b56a19c201

View File

@ -129,8 +129,10 @@
}, },
computed: { computed: {
searched: function () { searched: function () {
console.log(this.searchterm)
let searchRegex = new RegExp(this.searchterm, 'i')
return this.$store.state.Airports.airports return this.$store.state.Airports.airports
.filter(a => a.properties.icao.match(this.searchterm) || a.properties.name.match(this.searchterm)) .filter(a => searchRegex.test(a.properties.icao) || searchRegex.test(a.properties.name))
// .map(a => console.log(a.properties)) // .map(a => console.log(a.properties))
.map(a => ({ icao: a.properties.icao, name: a.properties.name })) .map(a => ({ icao: a.properties.icao, name: a.properties.name }))
} }