Last active
August 29, 2015 14:22
-
-
Save dferber90/d20e864c7a9f7bd7db81 to your computer and use it in GitHub Desktop.
Rest Operator
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
// ES5 | |
UI.registerHelper('sum', function (/* arguments */) { | |
var summands = Array.prototype.slice.call(arguments); | |
summands.pop(); // remove last argument hash (Spacebars.kw) | |
var sum = 0; | |
for (var i = 0; i < summands.length; i++) { | |
sum += summands[i]; | |
} | |
return sum; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment