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 lambda expressions as filter arguments. #16

Merged
merged 14 commits into from
Jan 22, 2025
Merged

Conversation

jg-rp
Copy link
Owner

@jg-rp jg-rp commented Jan 18, 2025

See #15

We've allowed for lambda expressions with multiple arguments. For an array input, a two-argument lambda expression is implicitly passed the item followed by the item's index in the array.. (item, index) => item.foo and index < 3.

Although not used by any filters at the moment, a two-argument lambda expression would be more useful if applied to a mapping/dictionary/hash/object, as it could be passed property/value pairs, one pair for each entry in the mapping.. (key, value) => key contains 'foo' and value.bar == '42'.

@jg-rp jg-rp linked an issue Jan 18, 2025 that may be closed by this pull request
@jg-rp jg-rp marked this pull request as ready for review January 22, 2025 11:42
@jg-rp jg-rp merged commit 6666c72 into main Jan 22, 2025
28 checks passed
@jg-rp jg-rp deleted the lambda-expressions branch January 22, 2025 11:43
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.

Lambda expressions in Liquid
1 participant