meteor/meteor — pull request #912 by ianserlin (2013-04-05 10:47:34+00:00)
Title: adds #each with index parity to Handlebars

Handlebars since at least 1.0.0-rc3 adds a special .index or .key property to each item in the array or object you are iterating over using an each block. Getting the index/key is a common enough use case for them to just include it in the base library and that's my feeling here too since I already need it, a la allowing users to re-arrange items in an array embedded in a document.

This commit enables {{#each}} block iteration over objects. It also provides the less intrusive _key (for objects) and _index (for arrays) properties for use within the #each's child block.

It is based on reviewing the current Handlebars implementation found here: https://github.com/wycats/handlebars.js/blob/master/lib/handlebars/base.js #88