Created
April 30, 2015 01:06
-
-
Save linus-amg/0aa05c65209aa6b3e519 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Handlebars.registerHelper('sum', function() { | |
var args = _.flatten(arguments); | |
var sum = 0; | |
var i = args.length - 1; | |
while (i--) { | |
sum += _.parseInt(args[i]) || 0; | |
} | |
return Number(sum); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment