Skip to content

Instantly share code, notes, and snippets.

@mkempe
Created March 25, 2013 14:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mkempe/5237663 to your computer and use it in GitHub Desktop.
Save mkempe/5237663 to your computer and use it in GitHub Desktop.
Handlebars.registerHelper 'forEach', (array, options) ->
return options.inverse @ if (options.inverse && !array.length)
array.map((item, index) ->
item.$index = index
item.$first = index is 0
item.$last = index is array.length - 1
options.fn item
).join ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment