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

Liquid zero does not equal false #65

Merged
merged 2 commits into from
Aug 16, 2022
Merged

Liquid zero does not equal false #65

merged 2 commits into from
Aug 16, 2022

Conversation

jg-rp
Copy link
Owner

@jg-rp jg-rp commented Aug 16, 2022

When used as the left value of the default filter, 0 should not be equal to False. Fixes #62.

Expected behaviour

{{ 0 | default: "something" }}
{{ 0 | default: "something", allow_false: true }}

Output

0
0

@jg-rp
Copy link
Owner Author

jg-rp commented Aug 16, 2022

Same goes for boolean expressions. Similarly, Liquid 1 should not equal True and 0 is not falsy.

Expected behaviour

{% if 0 == false %}Hello{% else %}Goodbye{% endif %}
{% if 1 == true %}Hello{% else %}Goodbye{% endif %}
{% if 0 %}Hello{% else %}Goodbye{% endif %}

Output

Goodbye
Goodbye
Hello

@jg-rp jg-rp merged commit a4d8e98 into main Aug 16, 2022
@hardiksondagar
Copy link

Thanks again @jg-rp

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

Successfully merging this pull request may close these issues.

StrictDefaultUndefined ignores undefined variables in filters other than default
2 participants