title: D3js collapse objects with duplicate properties
body: <pre><code>var dataset = [
   {'color': 'red', 'amount': 10},
   {'color': 'green', 'amount': 10},
   {'color': 'red', 'amount': 30},
   {'color': 'blue', 'amount': 20}
  ];
  </code></pre>
  
  <p>I want to collapse dataset into a newDataset array to only have one of each color with the amount property added like this:</p>
  
  <pre><code>newDataset = [
   {'color': 'red', 'amount': 40}, //combined 2 rows
   {'color': 'green', 'amount': 10},
   {'color': 'blue', 'amount': 20}
  ]
  </code></pre>
  
  <p>I am doing this successfully with a for loop in javascript, but would like to know <strong>if there is a d3.js helper function</strong> for cases like this? I can't seem to find one in the documentation, but I am not the best documentation-reader...</p>