Open
Description
in
operator doesn't work like Twig PHP when comparing arrays
For example, this evaluates to "true" with Twig PHP but "false" with twig.js:
{{ ["foo", "bar"] in [['foo', 'bar'], ['qux', 'baz']] ? 'true' : 'false' }}
This falls in this test:
twig.js/src/twig.expression.operator.js
Lines 20 to 23 in 788437f
indexOf
is not undefined
for arrays.
Also, ==
operator is broken with array (it only seems to compare array lengths):
{{ ['foo'] == ['bar'] ? 'true' : 'false' }}
Evaluates to "true" with twig.js but "false" with Twig PHP.
This time, I think the corresponding code is here:
twig.js/src/twig.expression.operator.js
Lines 170 to 178 in 788437f