Skip to content

Instantly share code, notes, and snippets.

@dferber90
Last active August 29, 2015 14:22
Show Gist options
  • Save dferber90/962bbcc9b84233a338fd to your computer and use it in GitHub Desktop.
Save dferber90/962bbcc9b84233a338fd to your computer and use it in GitHub Desktop.
Rest Operator in ES6
// ES6
UI.registerHelper('sum', function (...summands) {
summands.pop(); // remove last argument hash (Spacebars.kw)
return summands.reduce((previousValue, currentValue) => {
return previousValue + currentValue;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment