title: Javascript object with arrays to search param style query string
body: <p>Looking for clean way to convert a javascript object containing arrays as values to a search param compatible query string. Serializing an element from each array before moving to the next index.</p>
  
  <p>Using libraries such as querystring or qs, converts the object just fine, but handles each array independently. Passing the resulting string to the server (which I cannot change) causes an error in handling of the items as each previous value is overwritten by the next. Using any kind of array notation in the query string is not supported. The only option I have not tried is a custom sort function, but seems like it would be worse than writing a custom function to parse the object. Any revision to the object that would generate the expected result is welcome as well.</p>
  
  <pre><code>var qs = require("qs")
  var jsobj = {
      origString:['abc','123'],
      newString:['abcd','1234'],
      action:'compare'
  }
  qs.stringify(jsobj,{encode:false})
  qs.stringify(jsobj,{encode:false,indices:false})
  qs.stringify(jsobj,{encode:false,indices:false,arrayFormat:'repeat'})
  </code></pre>
  
  <p>Result returned is</p>
  
  <pre><code>"origString=abc&amp;origString=123&amp;newString=abcd&amp;newString=1234&amp;action=compare"
  </code></pre>
  Result desired would be
  
  <pre><code>"origString=abc&amp;newString=abcd&amp;origString=123&amp;newString=1234&amp;action=compare"
  </code></pre>