Skip to content

Instantly share code, notes, and snippets.

@SachaG
Created October 28, 2013 03:44
Show Gist options
  • Save SachaG/7191152 to your computer and use it in GitHub Desktop.
Save SachaG/7191152 to your computer and use it in GitHub Desktop.
Handlebars.registerHelper('each_with_index', function(items, options) {
var out = '';
for(var i=0, l=items.length; i<l; i++) {
var key = 'Branch-' + i;
out = out + Spark.labelBranch(key,function(){
options.fn(_.extend(items[i], {rank: i}));
});
}
console.log('each_with_index:')
console.log(out)
return out;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment