Shopify / Shopify/liquid

Anonymous functions in pipes?

Open
#886 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

For example, when I filter an array of hashes and try to get, say, the 2nd item of the array, I have to assign a new variable to the filtered array, and then get the item with newVar[1]. It would be nice if you could do something like this instead:

{% assign secondItemFilteredArray = hashArray | filter "month",4 | lambda x, x[1] %}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not identify any implementation files, tests, or entry points. Start by locating how Liquid parses filters and expressions, then review existing array-filter behavior before deciding how anonymous functions should be represented. Done means the proposed syntax has defined behavior and coverage for the filtering and indexing example.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.