Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created April 30, 2015 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linus-amg/0aa05c65209aa6b3e519 to your computer and use it in GitHub Desktop.
Save linus-amg/0aa05c65209aa6b3e519 to your computer and use it in GitHub Desktop.
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