{"id":20876733,"url":"https://github.com/terkelg/simultan","last_synced_at":"2025-05-12T15:32:29.854Z","repository":{"id":57361612,"uuid":"332873061","full_name":"terkelg/simultan","owner":"terkelg","description":"Simultaneously run an async function on any iterable with limited concurrency","archived":false,"fork":false,"pushed_at":"2021-01-27T12:26:35.000Z","size":4,"stargazers_count":15,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-08T16:13:08.387Z","etag":null,"topics":["async","concurrency","concurrent","iterator","promises"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/terkelg.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"terkelg"}},"created_at":"2021-01-25T20:22:58.000Z","updated_at":"2023-06-14T00:15:18.000Z","dependencies_parsed_at":"2022-09-07T19:52:20.026Z","dependency_job_id":null,"html_url":"https://github.com/terkelg/simultan","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fsimultan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fsimultan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fsimultan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terkelg%2Fsimultan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terkelg","download_url":"https://codeload.github.com/terkelg/simultan/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225141713,"owners_count":17427357,"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":["async","concurrency","concurrent","iterator","promises"],"created_at":"2024-11-18T06:54:39.144Z","updated_at":"2024-11-18T06:54:39.636Z","avatar_url":"https://github.com/terkelg.png","language":"JavaScript","funding_links":["https://github.com/sponsors/terkelg"],"categories":[],"sub_categories":[],"readme":"# Simultan [![CI](https://github.com/terkelg/simultan/workflows/CI/badge.svg)](https://github.com/terkelg/simultan/actions) [![npm](https://badgen.now.sh/npm/v/simultan)](https://npmjs.org/package/simultan)\n\n\u003e Simultaneously run an async function on any iterable with limited concurrency.\n\nSimultan takes an iterable, executes an async method on each value, and returns a single `Promise`. The promise contains an array of all the resolved return values. The number of concurrent invocations can be limited.\n\n## Install\n\n```\n$ npm install --save simultan\n```\n\n\n## Usage\n\n```js\nimport { simultan } from 'simultan';\n\nconst urls = [\n    // ... array of urls to fetch\n]\n\nawait simultan(urls, async url =\u003e {\n    const response = fetch(url);\n    return response.json();\n});\n//=\u003e [{...}, {...}, {...}, ]\n```\n\n\n## API\n\n### simultan\u003cT, R = unknown\u003e(iterable, fn, limit = 200)\nReturns: `Promise\u003cunknown[]\u003e`\n\nSimultan executes an async callback on each value of any [`Iterable`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). A single `Promise` is returned with an array of the resolved return values.\n\nThis returned promise will resolve when all invocations of the callback method have been resolved.\n\n#### iterable\nType: `Iterable\u003cT\u003e | AsyncIterable\u003cT\u003e`\u003cbr\u003e\nRequired: `true`\n\nIterable to iterate and execute async callback function on.\n\n#### fn\nType: `IteratorFn\u003cT, R\u003e = (item: T) =\u003e Promise\u003cR\u003e`\u003cbr\u003e\nRequired: `true`\n\n#### limit\nType: `number`\u003cbr\u003e\nDefault: `200`\u003cbr\u003e\nRequired: `false`\n\nMaximum number of concurrent invocations.\n\n## License\n\nMIT © [Terkel Gjervig](https://terkel.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fsimultan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterkelg%2Fsimultan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterkelg%2Fsimultan/lists"}