title: Vue.js filtering on array
body: <p>I am trying to filter an array using a computed property in vue.js.  I would like to search on on multiple fields, name, state, tags etc.</p>
  
  <p>My data:</p>
  
  <pre><code>events: [
    {
      id: 1,
      name: 'Name of event',
      url: '#',
      datetime: '2017-05-10T00:00:00Z',
      description: 'The full text of the event',
      state: 'VIC',
      tags: [
        'ordinary',
        'advanced'
      ]
    },
    {
      id: 2,
      name: 'Another event',
      url: '#',
      datetime: '2017-05-12T00:00:00Z',
      description: 'The full text of the event',
      state: 'VIC',
      tags: [
        'beginner'
      ]
    },
    {
      id: 3,
      name: 'Great event',
      url: '#',
      datetime: '2017-05-18T00:00:00Z',
      description: 'The full text of the event',
      state: 'NSW',
      tags: [
        'beginner'
      ]
    }
  ]
  </code></pre>
  
  <p>},</p>
  
  <p>The following function works as expected, however I cant work out how to have it search the items in 'tags' (commented out).</p>
  
  <pre><code>searchevents: function(){
    let result = this.events
    if (this.filterValue){
      result = result.filter(event =&gt;
        event.name.toLowerCase().includes(this.filterValue.toLowerCase()) ||
        event.state.toLowerCase().includes(this.filterValue.toLowerCase())
        // event.tags.toLowerCase().values().includes(this.filterValue.toLowerCase())
      )
    }
    return result
  }
  </code></pre>
  
  <p>The following returns a blank array, this method works ok when i have done it in angular but not in vue.</p>
  
  <pre><code>searchevents2: function(){
    var searchRegex = new RegExp(this.filterValue,'i')
    this.events.filter(function(event){
      return !self.filterValue || searchRegex.test(event.name) || searchRegex.test(event.state)
    })
  }
  </code></pre>
  
  <p>Ideally I would either like to be able to list array items to filter by or just filter by the entire array.</p>
  
  <p>Appreciate any help, first post here so be gentle.  I have a lot more experience with Python than Javascript so i may also use incorrect terminology at times.</p>