title: Write cleaner code for a dynamic object definition
body: <p>I'm using vue and trying to achieve a dynamic axios GET query which will be generated dynamically, based on what is filled in the search form. Right now I have this method in a single file component:</p>
  
  <p>UPDATE:</p>
  
  <pre><code>&lt;template lang="pug"&gt;
      div
          form(@submit.prevent="search")
              input(type='text', name="user_seq_id", placeholder="Customer ID")
              input(type='text', name="registered", placeholder="Registration date")
              input(type='text', name="email", placeholder="E-Mail")
              input(type='text', name="organization", placeholder="Organization")
              input(type='text', name="firstname", placeholder="Firstname")
              input(type='text', name="lastname", placeholder="Lastname")
              button(type="submit") Submit
  &lt;/template&gt;
  
  &lt;script&gt;
      export default {
          data () {
              return {
              }
          },
          methods: {
              search(e) {
                  let user_seq_id = e.target.elements.user_seq_id.value,
                      registered = e.target.elements.registered.value,
                      email = e.target.elements.email.value,
                      organization = e.target.elements.organization.value,
                      firstname = e.target.elements.firstname.value,
                      lastname = e.target.elements.lastname.value,
                      params = {
                          filter: 'role',
                          role: 'User',
                          sort: 'registered|desc'
                      }
  
                  if ( user_seq_id ) {
                      _.set(params, 'user_seq_id', user_seq_id)
                      params.filter = params.filter + ',user_seq_id'
                  }
                  if ( registered ) {
                      _.set(params, 'registered', registered)
                      params.filter = params.filter + ',registered'
                  }
                  if ( email ) {
                      _.set(params, 'email', email)
                      params.filter = params.filter + ',email'
                  }
                  if ( organization ) {
                      _.set(params, 'organization', organization)
                      params.filter = params.filter + ',organization'
                  }
                  if ( firstname ) {
                      _.set(params, 'firstname', firstname)
                      params.filter = params.filter + ',firstname'
                  }
                  if ( lastname ) {
                      _.set(params, 'lastname', lastname)
                      params.filter = params.filter + ',lastname'
                  }
  
                  this.$store.commit('users', null)
  
                  return this.$axios.get('/users', {
                          params: {
                              filter: 'role',
                              role: 'User',
                              sort: 'registered|desc'
                          }
                      })
                      .then( ({ data, headers, request, status, statusText }) =&gt; {
                          return this.$store.commit('users', data.result)
                      })
              }
          }
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Anyone here who knows to simplify this somehow? I find it very dump to repeat myself everytime and I'm sure there's a better way to do this. As you can see, I'm using "lodash" to inject properties to the "param" Object.</p>
  
  <p>Thanks in advance!!!</p>