harttle / liquidjs

A simple, expressive, safe and Shopify compatible template engine in pure JavaScript.
https://liquidjs.com
MIT License
1.5k stars 237 forks source link

`case` / `when` array equality #673

Closed jg-rp closed 4 months ago

jg-rp commented 6 months ago

Two arrays with the same elements compare equal with an if tag and the == oprator, but not within a case / when block.

{% assign x = "a,b,c" | split: "," %}
{% assign y = "a,b,c" | split: "," %}
{% case x %}{% when y %}TRUE{% else %}FALSE{% endcase %}
{% if x == y %}TRUE{% else %}FALSE{% endif %}

Shopify/Liquid output

TRUE
TRUE

LiquidJS output

FALSE
TRUE