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

Support filters in object for loop #949

Open
Azorlogh opened this issue Nov 22, 2024 · 2 comments
Open

Support filters in object for loop #949

Azorlogh opened this issue Nov 22, 2024 · 2 comments

Comments

@Azorlogh
Copy link

While this syntax is currently supported:

for element in array | myfilter

This one is unfortunately not:

for key, value in object | myfilter
@azemlya
Copy link

azemlya commented Nov 22, 2024

I also think this is a problem. But, I have a different view. It would be better to introduce such a syntax element (as is possible in Jinja2):

{% for k, v in my_map if k | length >= 10 and v is not null %}

That is, supporting the ternary operator in for would solve a lot of problems.

@Keats
Copy link
Owner

Keats commented Nov 25, 2024

I'm not sure about ternaries in for. Tera has continue/break so I feel like it wouldn't be needed, you can just have a if in your loop

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

3 participants