{"id":19947785,"url":"https://github.com/projectfluent/cached-iterable","last_synced_at":"2025-05-03T18:30:50.364Z","repository":{"id":48033248,"uuid":"135556348","full_name":"projectfluent/cached-iterable","owner":"projectfluent","description":"Iterables which cache the values they yield","archived":false,"fork":false,"pushed_at":"2024-09-26T21:49:59.000Z","size":241,"stargazers_count":6,"open_issues_count":7,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-17T02:46:37.160Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/projectfluent.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"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":"2018-05-31T08:38:21.000Z","updated_at":"2023-10-01T01:21:03.000Z","dependencies_parsed_at":"2024-06-18T18:13:45.598Z","dependency_job_id":null,"html_url":"https://github.com/projectfluent/cached-iterable","commit_stats":{"total_commits":16,"total_committers":3,"mean_commits":5.333333333333333,"dds":0.3125,"last_synced_commit":"5880eefa0b81656c3157666bc94e5b9bbedaf9ec"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectfluent%2Fcached-iterable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectfluent%2Fcached-iterable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectfluent%2Fcached-iterable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectfluent%2Fcached-iterable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectfluent","download_url":"https://codeload.github.com/projectfluent/cached-iterable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252235152,"owners_count":21716173,"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-11-13T00:37:22.309Z","updated_at":"2025-05-03T18:30:50.046Z","avatar_url":"https://github.com/projectfluent.png","language":"JavaScript","readme":"# cached-iterable\n\n`cached-iterable` exposes two classes which implement the [iterable\nprotocol][]:\n\n  - `CachedSyncIterable`,\n  - `CachedAsyncIterable`.\n\nYou can wrap any iterable in these classes to create a new iterable which\ncaches the yielded elements. This is useful for iterating over an iterable many\ntimes without depleting it.\n\n[iterable protocol]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol\n\n## Installation\n\n`cached-iterable` can be used both on the client-side and the server-side.  You\ncan install it from the npm registry or use it as a standalone script (as the\n`CachedIterable` global).\n\n    npm install cached-iterable\n\n## How to use\n\n```js\nimport assert from \"assert\";\nimport {CachedSyncIterable} from \"cached-iterable\";\n\nfunction * countdown(i) {\n    while (i--) {\n        yield i;\n    }\n}\n\nlet numbers = new CachedSyncIterable(countdown(3));\n\n// `numbers` can be iterated over multiple times.\nassert.deepEqual([...numbers], [3, 2, 1, 0]);\nassert.deepEqual([...numbers], [3, 2, 1, 0]);\n```\n\n## Compatibility\n\nFor legacy browsers, the `compat` build has been transpiled using Babel's [env\npreset][]. It requires the regenerator runtime provided by [babel-polyfill][].\n\n```javascript\nimport {CachedSyncIterable} from 'cached-iterable/compat';\n```\n\n[env preset]: https://babeljs.io/docs/plugins/preset-env/\n[babel-polyfill]: https://babeljs.io/docs/usage/polyfill/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectfluent%2Fcached-iterable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectfluent%2Fcached-iterable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectfluent%2Fcached-iterable/lists"}