Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

105
Views
Distinguish whether helper is called with or without a hash (#)

I need to distinguish how the helper is being called, for example following 2 cases

{{#myHelper data}}{{myHelperResponse}}{{/myHelper}}

{{myHelper data}}

Within the Javascript helper method, is it possible to distinguish between these 2 calls.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Checking the last argument options. When calling an helper method with opening and closing mustaches, there are 2 methods available options.fn and options.inverse, such as:

Handlebars.registerHelper('myHelper', function() {
  const options = arguments[arguments.length - 1];
  return options.fn ? options.fn('TRUE') : 'FALSE';
});

{{#myHelper}}{{this}}{{/myHelper}} // This outputs TRUE

{{myHelper}} // This outputs FALSE
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!