Handlebars:
Template
{{foo}}
{{foo true}}
{{foo 2 true}}
{{#foo true}}{{/foo}}
{{#foo}}{{/foo}}
Preparation-Script
Handlebars.registerHelper('helperMissing', function( /* dynamic arguments */) {
  var options = arguments[arguments.length-1];
  var args = Array.prototype.slice.call(arguments, 0,arguments.length-1)
  return new Handlebars.SafeString("Missing: "+options.name+"("+args+")")
})
Input
null
Output
Missing: foo()
Missing: foo(true)
Missing: foo(2,true)
Missing: foo(true)
最后更新: 2020/1/11 15:46:21