title: How can I merge two array of objects and concatenate values?
body: <p>I have this two array of objects</p>
  
  <pre><code>var client = [{
          "creazione": "1970-01-01",
          "value": 2
      }, {
          "creazione": "2014-03-12",
          "value": 4
      }, {
          "creazione": "2014-03-14",
          "value": 1
      }],
      order = [{
          "creazione": "1970-01-01",
          "value": 1
      }, {
          "creazione": "2014-03-13",
          "value": 5
      }, {
          "creazione": "2014-03-14",
          "value": 1
      }];
  </code></pre>
  
  <p>I need to merge these two arrays to get something like:</p>
  
  <pre><code> [{
       x: '1970-01-01',
       y: [2, 1]
   }, {
       x: '2014-03-12',
       y: [4, 0]
   }, {
       x: '2014-03-14',
       y: [1, 1]
   }, {
       x: '2014-03-13',
       y: [0, 5]
   }]
  </code></pre>
  
  <p>In few words I need to check if <code>a.creazione == b.creazione</code> then merge the key and concat the values in an array (first line of result), else if it is different, assign the value of the existing array in the right position of the <code>y</code> array (third line of result).</p>
  
  <p>PS: I need to get this structure beacuse I'm using <a href="http://chinmaymk.github.io/angular-charts/" rel="nofollow">Angular-Charts</a> library, and it ask for data in this uncomfortable way.</p>
  
  <p>Any idea on how to achieve this?</p>