title: How do I implement condition for last item with #each block in Meteor?
body: <p>I've upgraded my meteor app to 0.8.0 and now the handlebars custom helpers have stopped working, the helper allows me to alter the behaviour when the last item is appended on to a list, does anyone know how I can get the handlebars helper working again or how I can get this functionality working with the latest version of meteor, thanks!</p>
  
  <p>Helper Code <a href="https://stackoverflow.com/questions/11479094/conditional-on-last-item-in-array-using-handlebars-js-template">(Original Link)</a></p>
  
  <pre><code>Handlebars.registerHelper("foreach", function(arr, options){
  
    if(options.inverse &amp;&amp; !arr.length)
      return options.inverse(this);
  
    return arr.map(function(item, index){
      item.$index = index;
      item.$first = index === 0;
      item.$last  = index === arr.length - 1;
      return options.fn(item);
    }).join('');
  });
  </code></pre>