Shopify / Shopify/liquid

Filter request: keys/values

Open
#1,439 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

One very common need is a way to get all keys or values from a hash; for example, site.data.<folder> in Jekyll returns a hash, where the keys are the base name of the filename, and the values are the contents of the yaml files in the folder.

The filter would look like this:

# Keys of a hash
def keys(input)
  input.keys
end

# Values of a hash
def values(input)
  input.values
end

You could even provide a shortcut form, hash.values, perhaps? Though just the filter hash | values would be enough for me.

If you are interested, I could help draft a PR with tests and docs.

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 name specific files, tests, or entry points. Start by locating existing Liquid filter implementations and their tests, then determine where filter documentation belongs; done means the requested hash key and value behavior is covered by tests and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
web-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.