Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get array/string/object length through helper for branching #428

Closed
dscottboggs opened this issue May 1, 2021 · 2 comments
Closed

Get array/string/object length through helper for branching #428

dscottboggs opened this issue May 1, 2021 · 2 comments

Comments

@dscottboggs
Copy link

dscottboggs commented May 1, 2021

For example, I want to do

{{#if len items eq 1}}
Item: {{items.[0]}}
{{ else }}
Items: {{ join items }}
{{/if}}

but helpers only support writing to output, not returning a value for comparison. Is there a way to write a helper which assists in branching like this?

@dscottboggs
Copy link
Author

Never mind, this is resolved by #421. Could this be documented?

@sunng87
Copy link
Owner

sunng87 commented May 2, 2021

I will. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants