Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: CoffeeScript  |  size: 0.28 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Works      
  2. f = _.map awards, (a) -> a.points
  3. func = (sum, current) -> sum + current
  4. retObj.points = _.reduce f, func, 0
  5.  
  6. # Doesn't work, why ?? Says Parse error on line 1: Unexpected ','
  7. retObj.points = _reduce (_.map awards, (a) -> a.points), (sum, current) -> sum + current, 0