In the JS library you can chain else with any block helper - not just if and unless.
I'm currently using else with a custom helper that does Regex matching:
{{#match cultureCode "^de\b"}}
...
{{else match cultureCode "^it\b"}}
...
This example can be worked around easily by changing the helper and switching to sub-expressions ({{#if (match ...)}}), but this is something that works in the JS library.
It would be nice if it allowed if, each and unless to be defined as regular helpers.
I created a solution for this (before I realised else if was supported) that expanded {{#A}}{{else B}}{{/A}} into {{#A}}{{else}}{{#B}}{{/B}}{{/A}}. Looking at the existing code it seems like combining the ConditionalBlockAccumulatorContext and BlockHelperAccumulatorContext would be a better approach.
In the JS library you can chain
elsewith any block helper - not justifandunless.I'm currently using
elsewith a custom helper that does Regex matching:This example can be worked around easily by changing the helper and switching to sub-expressions (
{{#if (match ...)}}), but this is something that works in the JS library.It would be nice if it allowed
if,eachandunlessto be defined as regular helpers.I created a solution for this (before I realised
else ifwas supported) that expanded{{#A}}{{else B}}{{/A}}into{{#A}}{{else}}{{#B}}{{/B}}{{/A}}. Looking at the existing code it seems like combining theConditionalBlockAccumulatorContextandBlockHelperAccumulatorContextwould be a better approach.