twig.js
twig.js copied to clipboard
Add filter, map and reduce filters with support for arrow functions
There are few nice features were added to Twig.
Please add support for this features. At current stage compilation process fails on parse mode of such constructions like:
{% for product in related_products|filter(product => product.stock > 10) %}
{# ... #}
{% endfor %}
I'm missing this soo much....
As mentioned in #861, the following needs to be done:
- Add support for arrow functions in limited contexts to match where TwigPHP allows them.
- Allow arrow functions to be used in filters that already exist like
sort
. - Add
filter
,map
, andreduce
filters that rely on support for arrow functions.
Could one of the maintainers point me out into the right direction; would you like this implemented as a logic token type or as an expression type? @antoineveldhoven which one does TwigPHP use? Trying to match that would be a good start, if possible.
Hello,
We are currently migrating part of our existing Symfony applications to a new infrastructure and this is a blocking issue for us. I'll be glad to contribute but it would be nice if you could please give me some leads to start implementing this properly :)