{"id":15667931,"url":"https://github.com/rupurt/enumerati","last_synced_at":"2025-06-12T14:04:34.369Z","repository":{"id":35013984,"uuid":"196657958","full_name":"rupurt/enumerati","owner":"rupurt","description":"Filter and order an enumerable collection of structs","archived":false,"fork":false,"pushed_at":"2023-05-01T15:59:14.000Z","size":85,"stargazers_count":1,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-29T11:07:05.205Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-12T23:37:46.000Z","updated_at":"2023-06-28T19:23:19.000Z","dependencies_parsed_at":"2024-10-03T14:16:21.556Z","dependency_job_id":null,"html_url":"https://github.com/rupurt/enumerati","commit_stats":{"total_commits":58,"total_committers":4,"mean_commits":14.5,"dds":0.603448275862069,"last_synced_commit":"d6cd633b5dd0abfc72f2c69a89b41db7145817d4"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fenumerati","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fenumerati/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fenumerati/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rupurt%2Fenumerati/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rupurt","download_url":"https://codeload.github.com/rupurt/enumerati/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252757956,"owners_count":21799755,"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":[],"created_at":"2024-10-03T14:05:52.168Z","updated_at":"2025-05-06T19:47:42.661Z","avatar_url":"https://github.com/rupurt.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Enumerati\n[![Build Status](https://github.com/rupurt/enumerati/workflows/test/badge.svg?branch=master)](https://github.com/rupurt/enumerati/actions?query=workflow%3Atest)\n[![hex.pm version](https://img.shields.io/hexpm/v/enumerati.svg?style=flat)](https://hex.pm/packages/enumerati)\n\nFilter and order an enumerable collection of structs\n\n## Installation\n\n```elixir\ndef deps do\n  [{:enumerati, \"~\u003e 0.0.8\"}]\nend\n```\n\n## Usage\n\nFilter\n\n```elixir\ndefmodule Person do\n  defstruct ~w(first_name last_name)a\nend\n\nrick_ross = %Person{first_name: \"rick\", last_name: \"ross\"}\nrick_james = %Person{first_name: \"rick\", last_name: \"james\"}\nlebron_james = %Person{first_name: \"lebron\", last_name: \"james\"}\ncharles_barkley = %Person{first_name: \"charles\", last_name: \"barkley\"}\npeople = [rick_ross, charles_barkley, lebron_james, rick_james]\n\n# match and\nand_matches = Enumerati.filter(people, [first_name: \"lebron\", last_name: \"james\"])\nEnum.count(and_matches) == 1\nEnum.member?(and_matches, lebron_james) == true\n\n# match or\nor_matches = Enumerati.filter(people, [first_name: [\"lebron\", \"charles\"]])\nEnum.count(or_matches) == 2\nEnum.member?(or_matches, lebron_james) == true\nEnum.member?(or_matches, charles_barkley) == true\n```\n\nOrder\n\n```elixir\ndefmodule Product do\n  defstruct ~w(name price)a\nend\n\nproduct_1 = %Support.Product{name: \"Product 1\", price: Decimal.new(\"0.4668\")}\nproduct_2 = %Support.Product{name: \"Product 2\", price: Decimal.new(\"-0.6142\")}\nproduct_3 = %Support.Product{name: \"Product 3\", price: Decimal.new(\"0.6468\")}\nproduct_4 = %Support.Product{name: \"Product 4\", price: Decimal.new(\"-0.7109\")}\nproducts = [product_1, product_2, product_3, product_4]\n\n# ascending\nEnumerati.order(products, [:price]) == [\n product_4,\n product_2,\n product_1,\n product_3\n]\n\nEnumerati.order(products, [{:price, :asc}]) == [\n product_4,\n product_2,\n product_1,\n product_3\n]\n\n# descending\nEnumerati.order(products, [{:price, :desc}]) == [\n product_3\n product_1,\n product_2,\n product_4,\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupurt%2Fenumerati","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frupurt%2Fenumerati","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frupurt%2Fenumerati/lists"}