title: using underscore to total array elements with coffee script
body: <p>i have this list which contains an arrays:</p>
  
  <pre><code>invoicedItems = [
    { sku: 'EP01-MGY1'
        quantity: 10
        unit_price: 473
        vat: 0
        price: 4730 },
    { sku: 'EP01-MGY2'
      quantity: 80
      unit_price: 426
      vat: 0
      price: 34080 },
    { sku: 'EP01-MGY3'
      quantity: 1
      unit_price: 612
      vat: 0
      price: 612 },
  ]
  </code></pre>
  
  <p>what is the correct way to add the totals for <code>price</code> and <code>vat</code>, so that i get:</p>
  
  <pre><code>{ goodsTotal: XXX, goodsVAT: YYY }
  </code></pre>
  
  <p>i tried this:</p>
  
  <pre><code>if invoicedItems
    console.log invoicedItems
    result.invoicedGoodsTotals = 
      goodsTotal: _.reduce( invoicedItems.items, ((s,it) -&gt; s + it.price), 0 )
      goodsVAT: _.reduce( invoicedItems.items, ((s,it) -&gt; s + it.vat), 0 )
    console.log result.invoicedGoodsTotals
  </code></pre>
  
  <p>but this did not work.</p>
  
  <p>only returned </p>
  
  <p>{ goodsTotal: 0, goodsVAT: 0 }</p>
  
  <p>Any advise much appreciated.</p>