{"id":16698075,"url":"https://github.com/arlac77/aggregate-async-iterator","last_synced_at":"2025-04-10T02:55:16.897Z","repository":{"id":37792841,"uuid":"268084712","full_name":"arlac77/aggregate-async-iterator","owner":"arlac77","description":"Aggregates several async iterators into one","archived":false,"fork":false,"pushed_at":"2025-04-06T00:06:57.000Z","size":1782,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T00:24:06.171Z","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":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arlac77.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":"2020-05-30T13:26:04.000Z","updated_at":"2025-04-06T00:06:59.000Z","dependencies_parsed_at":"2023-09-21T21:56:29.620Z","dependency_job_id":"601f6497-41cb-4aac-aa39-f5c154072d9d","html_url":"https://github.com/arlac77/aggregate-async-iterator","commit_stats":{"total_commits":551,"total_committers":4,"mean_commits":137.75,"dds":"0.22323049001814887","last_synced_commit":"b6efff7dc315afba510619568781b2b06be8f24a"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Faggregate-async-iterator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Faggregate-async-iterator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Faggregate-async-iterator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Faggregate-async-iterator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arlac77","download_url":"https://codeload.github.com/arlac77/aggregate-async-iterator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248147469,"owners_count":21055540,"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-12T17:50:39.769Z","updated_at":"2025-04-10T02:55:16.872Z","avatar_url":"https://github.com/arlac77.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/aggregate-async-iterator.svg)](https://www.npmjs.com/package/aggregate-async-iterator)\n[![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)\n[![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\\\u0026label\\\u0026labelColor=blue\\\u0026color=555555)](https://typescriptlang.org)\n[![bundlejs](https://deno.bundlejs.com/?q=aggregate-async-iterator\\\u0026badge=detailed)](https://bundlejs.com/?q=aggregate-async-iterator)\n[![downloads](http://img.shields.io/npm/dm/aggregate-async-iterator.svg?style=flat-square)](https://npmjs.org/package/aggregate-async-iterator)\n[![GitHub Issues](https://img.shields.io/github/issues/arlac77/aggregate-async-iterator.svg?style=flat-square)](https://github.com/arlac77/aggregate-async-iterator/issues)\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Faggregate-async-iterator%2Fbadge\\\u0026style=flat)](https://actions-badge.atrox.dev/arlac77/aggregate-async-iterator/goto)\n[![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Known Vulnerabilities](https://snyk.io/test/github/arlac77/aggregate-async-iterator/badge.svg)](https://snyk.io/test/github/arlac77/aggregate-async-iterator)\n[![Coverage Status](https://coveralls.io/repos/arlac77/aggregate-async-iterator/badge.svg)](https://coveralls.io/github/arlac77/aggregate-async-iterator)\n\n# aggregate-async-iterator\n\nAggregates several async iterators into one (zip)\n\n# usage\n\n```js\nimport { aggregateRoundRobin, aggregateFifo } from \"aggregate-async-iterator\";\n\nasync function* sequence(name, time = 100, num = 10) {\n  for (let i = 0; i \u003c num; i += 1) {\n    yield new Promise(resolve =\u003e setTimeout(resolve(name + i), time));\n  }\n}\n\nconsole.log(\"RR:\");\n\nfor await (const r of aggregateRoundRobin([\n    sequence(\"A\", 100, 3),\n    sequence(\"B\", 35, 5)\n  ])) {\n  console.log(r);\n}\n\nconsole.log(\"FIFO:\");\n\nfor await (const r of aggregateFifo([\n    sequence(\"A\", 100, 3),\n    sequence(\"B\", 35, 5)\n  ])) {\n  console.log(r);\n}\n```\n\nPrints interleaved sequences\n\n```txt\nRR:\nA0\nB0\nA1\nB1\nA2\nB2\nB3\nB4\nFIFO:\nA0\nB0\nA1\nB1\nA2\nB2\nB3\nB4\n```\n\n# API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n*   [aggregateFifo](#aggregatefifo)\n    *   [Parameters](#parameters)\n*   [aggregateRoundRobin](#aggregateroundrobin)\n    *   [Parameters](#parameters-1)\n\n## aggregateFifo\n\nAggregate items from sevaral async iterators into one.\nItems are collected first in first out from the sources.\nWhatever source comes first will be delivered first.\n\n### Parameters\n\n*   `sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\\\u003cAsyncIterator\\\u003cany\u003e\u003e**\u0026#x20;\n\nReturns **AsyncIterable\\\u003cany\u003e** items collected from all sources\n\n## aggregateRoundRobin\n\nAggregate items from sevaral async iterators into one.\nItems are collected round robin from the sources.\nThe 2nd. round of items will only be delivered after all sources\nhave delivered their 1st. round (or reached their end).\n\n### Parameters\n\n*   `sources` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\\\u003cAsyncIterator\\\u003cany\u003e\u003e**\u0026#x20;\n\nReturns **AsyncIterable\\\u003cany\u003e** items collected from all sources\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```shell\nnpm install aggregate-async-iterator\n```\n\n# license\n\nBSD-2-Clause\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Faggregate-async-iterator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farlac77%2Faggregate-async-iterator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Faggregate-async-iterator/lists"}