{"id":15667899,"url":"https://github.com/rupurt/juice","last_synced_at":"2025-04-30T22:23:57.238Z","repository":{"id":57510573,"uuid":"132311450","full_name":"rupurt/juice","owner":"rupurt","description":"Reduce in memory data structures using a lightweight query language","archived":false,"fork":false,"pushed_at":"2020-06-22T03:52:04.000Z","size":29,"stargazers_count":27,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T20:33:38.837Z","etag":null,"topics":["elixir","query"],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rupurt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-06T06:01:40.000Z","updated_at":"2025-01-21T18:15:22.000Z","dependencies_parsed_at":"2022-09-26T17:50:54.281Z","dependency_job_id":null,"html_url":"https://github.com/rupurt/juice","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fjuice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fjuice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fjuice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fjuice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rupurt","download_url":"https://codeload.github.com/rupurt/juice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251790412,"owners_count":21644215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","query"],"created_at":"2024-10-03T14:05:47.036Z","updated_at":"2025-04-30T22:23:57.218Z","avatar_url":"https://github.com/rupurt.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Juice\n\n[![Build Status](https://github.com/rupurt/juice/workflows/test/badge.svg?branch=master)](https://github.com/rupurt/juice/actions?query=workflow%3Atest)\n[![hex.pm version](https://img.shields.io/hexpm/v/juice.svg?style=flat)](https://hex.pm/packages/juice)\n\nReduce in memory data structures using a lightweight query language\n\n## Installation\n\nAdd `juice` to your list of dependencies in `mix.exs`\n\n```elixir\ndef deps do\n  [{:juice, \"~\u003e 0.0.3\"}]\nend\n```\n\n## Usage\n\nJuice can collect and reject string or atom keys from an Elixir [Map](https://hexdocs.pm/elixir/Map.html) or [List](https://hexdocs.pm/elixir/List.html).\n\nGiven the map\n\n```elixir\niex\u003e fruit_basket = %{\n\tapples: {\n\t\tgranny_smith: 10,\n\t\tgolden_delicious: 3\n\t},\n\t\"oranges\" =\u003e 5,\n\tplums: 6,\n\t\"mangos\" =\u003e 2,\n\trecipients: [:steph, \"michael\", :lebron, \"charles\"]\n}\n```\n\nReturn everything with a wildcard `*`\n\n```elixir\niex\u003e Juice.squeeze(fruit_basket, \"*\") == %{\n\tapples: {\n\t\tgranny_smith: 10,\n\t\tgolden_delicious: 3\n\t},\n\t\"oranges\" =\u003e 5,\n\tplums: 6,\n\t\"mangos\" =\u003e 2,\n\trecipients: [:steph, \"michael\", :lebron, \"charles\"]\n}\n```\n\nRemove `plums` and `mangos`\n\n```elixir\niex\u003e Juice.squeeze(fruit_basket, \"* -plums -mangos\") == %{\n\tapples: {\n\t\tgranny_smith: 10,\n\t\tgolden_delicious: 3\n\t},\n\t\"oranges\" =\u003e 5,\n\trecipients: [:steph, \"michael\", :lebron, \"charles\"]\n}\n```\n\nOnly collect `granny_smith` `apples` and `oranges` with nested `.` notation\n\n```elixir\niex\u003e Juice.squeeze(fruit_basket, \"apples.granny_smith oranges\") == %{\n\tapples: {\n\t\tgranny_smith: 10,\n\t},\n\t\"oranges\" =\u003e 5\n}\n```\n\nCollect `plums` and `mangos` for `charles`\n\n```elixir\niex\u003e Juice.squeeze(fruit_basket, \"plums mangos recipients.charles\") == %{\n\tplums: 6,\n\t\"mangos\" =\u003e 2,\n\trecipients: [\"charles\"]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupurt%2Fjuice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frupurt%2Fjuice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupurt%2Fjuice/lists"}