title: use array to pass as a parameter to a function in helper, in side {{#each}} for same array(handlebars)
body: <p>I am trying to use {{#each}} in email templates. I want to use the same array to pass as a parameter to helper function, to do some stuff. I am unable to get the value of the array inside the loop.</p>
  
  <p>Here is my code that I am using.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>Handlebars.registerHelper('ifSameCbeprev', function(index, msg, options) { 
   var ind = parseInt(index);
   var x = ind - 1 ;
      console.log(msg); //here value is undefined.
   if(x&lt;0)
   {  
    return options.inverse(this);
   }
   else
   {
    console.log(msg);
    if(msg[ind].cbe === msg[x].cbe)
    {   
     return options.fn(this);
    }
    else
    {   
     return options.inverse(this);
    }
   }
  
    
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
    &lt;body&gt;
      {{#each msg}}
          &lt;!-- If task is created  --&gt;
          {{#iftytask ty}}
          &lt;tr width="100%" height="auto" style=" min-height:40px;"&gt;
          &lt;td width="100%" height="100%"&gt;
         &lt;table width="100%" height="auto" style="padding:10px;"&gt;
           &lt;tr width="100%" height="auto"style="position:relative;"&gt;
               &lt;td width="98%" height="100%" style="font-size:16px; font-weight: bold;"&gt;
                    {{#ifSameCbeprev @index ../msg}}
  
                     {{else}}
                         &lt;span&gt;{{cfna}}&lt;/span&gt;
                  {{/ifSameCbeprev}}
                &lt;/td&gt;
            &lt;/tr&gt;
         &lt;/table&gt;
       &lt;/td&gt;
      &lt;/tr&gt;
      {{/each}}
      &lt;/body&gt;
    &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>The code i am using is as above. 
  ../msg is giving undefined(i.e. msg in ifSameCbeprev). I tried using 'this', msg and ../../msg as well in place of ../msg. But always I am getting undefined inside the function ifSameCbeprev.
  Any idea how to use the array inside the {{#each}}? 
  Thanks in advance for any kind of help. </p>