Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

110
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda