{"id":15835824,"url":"https://github.com/asross/lazier_enumerator","last_synced_at":"2025-07-05T23:33:14.267Z","repository":{"id":56880821,"uuid":"56114976","full_name":"asross/lazier_enumerator","owner":"asross","description":"Adds support for compact, flatten, and uniq to lazy enumerators in Ruby","archived":false,"fork":false,"pushed_at":"2016-04-15T22:32:44.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-25T09:02:26.084Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asross.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-13T02:40:23.000Z","updated_at":"2016-04-13T02:43:53.000Z","dependencies_parsed_at":"2022-08-20T22:31:19.809Z","dependency_job_id":null,"html_url":"https://github.com/asross/lazier_enumerator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asross%2Flazier_enumerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asross%2Flazier_enumerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asross%2Flazier_enumerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asross%2Flazier_enumerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asross","download_url":"https://codeload.github.com/asross/lazier_enumerator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243222183,"owners_count":20256220,"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-05T14:41:42.719Z","updated_at":"2025-03-12T12:41:40.854Z","avatar_url":"https://github.com/asross.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lazier Enumerators [![Build Status](https://api.travis-ci.org/asross/lazier_enumerator.svg)](https://travis-ci.org/asross/lazier_enumerator)\n\nThis library adds support for `uniq`, `flatten`, and `compact` to Ruby 2.0's\n[`Enumerator::Lazy`](http://ruby-doc.org/core-2.0.0/Enumerator/Lazy.html).\n\n## Basic Usage\n\nInstead of\n\n```ruby\nenumerable.flatten.compact.uniq.map(\u0026:uppercase)\n```\n\nwhich would loop through the `enumerable` multiple times, you can do\n\n```ruby\nrequire 'lazier_enumerator'\n\nenumerable.lazy.flatten.compact.uniq.map(\u0026:uppercase).force\n```\n\nafter running\n\n```sh\ngem install lazier_enumerator\n```\n\nwhich will do the same thing, but lazily, only loading one element of\n`enumerable` at a time and only looping through it once.\n\nIn practice, based on benchmarks of this library and `Enumerator::Lazy` itself,\nfor most enumerables lazy enumeration is actually ~2x slower than normal\nenumeration -- so use this library with a grain of salt :)\n\n## If you want something even lazier (and slower)\n\nYou can require `lazier_enumerator/even_lazier`, which will define additional\nmethods on `Enumerable` to provide lazy support for a variety of operations --\nbut in practice they take ~10x longer than their industrious versions.\n\n```ruby\nrequire 'lazier_enumerator/even_lazier'\n\n# pass procs or symbols, not blocks, to lmap/lselect/lreject\n\n[1,-2,[3,nil,[4]]].lflatten.lcompact.luniq.lmap(:abs).lselect(:even?).each do |i|\n  puts i\nend\n\n# =\u003e 2 4\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasross%2Flazier_enumerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasross%2Flazier_enumerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasross%2Flazier_enumerator/lists"}