title: Aggregate and transform array of objects
body: <p>Using javascript functional programming methods (like map/reduce), how would one aggregate/count the <code>status</code> field of <code>arr1</code> and transform it to an array of key/value objects in <code>arr2</code>. </p>
  
  <pre><code>arr1 = [
    {'task':'do something 1', 'status':'done'} , 
    {'task':'do something 2', 'status':'done'} , 
    {'task':'do something 3', 'status':'pending'} , 
    {'task':'do something 4', 'status':'done'}
  ];
  
  // Aggregate arr1 `status` field and transform to:
  
  arr2 = [
    {key:'done', value: 3},
    {key:'pending', value: 1}
  ];
  </code></pre>
  
  <p>Here's my WIP <strong>partial</strong> solution that handles <strong>only</strong> the aggregation portion. I still need the transform portion. </p>
  
  <pre><code>var arr2 = arr1.map(function(item) {
      return item.status;
    }).reduce(function(acc,curr,idx){
      if(acc[curr] === undefined) acc[curr] = 1;
      else acc[curr] += 1;
      return acc;
    }, []); 
  </code></pre>