javascript - How do I implement condition for last item with #each block in Meteor? -


i've upgraded meteor app 0.8.0 , handlebars custom helpers have stopped working, helper allows me alter behaviour when last item appended on list, know how can handlebars helper working again or how can functionality working latest version of meteor, thanks!

helper code (original link)

handlebars.registerhelper("foreach", function(arr, options){    if(options.inverse && !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(''); }); 

meteor has migrated handlebars namespace ui

ui.registerhelper("foreach", function(arr, options){   return arr.map(function(item, index){     item.$index = index;     item.$first = index === 0;     item.$last  = index === arr.length - 1;     return options.fn(item);   }).join(''); }); 

Comments

Popular posts from this blog

python 3.x - Mapping specific letters onto a list of words -

javascript - jquery or ashx not working -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -