{"id":16351588,"url":"https://github.com/tomeraberbach/limit-concur","last_synced_at":"2025-10-24T08:17:33.276Z","repository":{"id":66020149,"uuid":"354442493","full_name":"TomerAberbach/limit-concur","owner":"TomerAberbach","description":"⚖️ Limit an async function's concurrency with ease!","archived":false,"fork":false,"pushed_at":"2025-09-01T20:37:13.000Z","size":533,"stargazers_count":23,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-06T13:58:58.052Z","etag":null,"topics":["async","concurrency","javascript","nodejs","npm-module","npm-package","promise","rate-limiting"],"latest_commit_sha":null,"homepage":"https://npm.im/limit-concur","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TomerAberbach.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"contributing.md","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":"2021-04-04T02:56:44.000Z","updated_at":"2025-09-01T20:37:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd9ad69b-1e04-469b-b904-ae3e33ffc7e5","html_url":"https://github.com/TomerAberbach/limit-concur","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"0271b4c1620dccaa183b527c179820d749e0fff0"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/TomerAberbach/limit-concur","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomerAberbach%2Flimit-concur","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomerAberbach%2Flimit-concur/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomerAberbach%2Flimit-concur/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomerAberbach%2Flimit-concur/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomerAberbach","download_url":"https://codeload.github.com/TomerAberbach/limit-concur/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomerAberbach%2Flimit-concur/sbom","scorecard":{"id":142742,"data":{"date":"2025-08-11","repo":{"name":"github.com/TomerAberbach/limit-concur","commit":"e7309999024eb9a098db6f98402087916af70f19"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":5,"reason":"6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/TomerAberbach/limit-concur/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/TomerAberbach/limit-concur/ci.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/ci.yml:29","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":10,"reason":"project is fuzzed","details":["Info: TypeScriptPropertyBasedTesting integration found: src/index.test.ts:2","Info: TypeScriptPropertyBasedTesting integration found: src/index.test.ts:2"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license-apache:0","Info: FSF or OSI recognized license: Apache License 2.0: license-apache:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-16T08:33:39.040Z","repository_id":66020149,"created_at":"2025-08-16T08:33:39.040Z","updated_at":"2025-08-16T08:33:39.040Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274580461,"owners_count":25311181,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","javascript","nodejs","npm-module","npm-package","promise","rate-limiting"],"created_at":"2024-10-11T01:23:17.930Z","updated_at":"2025-10-24T08:17:33.199Z","avatar_url":"https://github.com/TomerAberbach.png","language":"TypeScript","funding_links":["https://github.com/sponsors/TomerAberbach"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  limit-concur\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://npmjs.org/package/limit-concur\"\u003e\n    \u003cimg src=\"https://badgen.net/npm/v/limit-concur\" alt=\"version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/TomerAberbach/limit-concur/actions\"\u003e\n    \u003cimg src=\"https://github.com/TomerAberbach/limit-concur/workflows/CI/badge.svg\" alt=\"CI\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://unpkg.com/limit-concur/dist/index.js\"\u003e\n    \u003cimg src=\"https://deno.bundlejs.com/?q=limit-concur\u0026badge\" alt=\"gzip size\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://unpkg.com/limit-concur/dist/index.js\"\u003e\n    \u003cimg src=\"https://deno.bundlejs.com/?q=limit-concur\u0026config={%22compression%22:{%22type%22:%22brotli%22}}\u0026badge\" alt=\"brotli size\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/sponsors/TomerAberbach\"\u003e\n    \u003cimg src=\"https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86\" alt=\"Sponsor\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n  Limit an async function's concurrency with ease!\n\u003c/div\u003e\n\n## Features\n\n- **Tiny:** only ~300 B minzipped\n- **Flexible:** works for any function that returns a `Promise`\n\n## Install\n\n```sh\n$ npm i limit-concur\n```\n\n## Usage\n\n```js\nimport limitConcur from 'limit-concur'\n\nconst categories = await (\n  await fetch(`https://api.chucknorris.io/jokes/categories`)\n).json()\n\nlet pendingRequests = 0\nconst getChuckNorrisJoke = async category =\u003e {\n  console.log(`pending requests: ${++pendingRequests}`)\n  const response = await fetch(\n    `https://api.chucknorris.io/jokes/random?category=${encodeURIComponent(category)}`,\n  )\n  const { value } = await response.json()\n  console.log(`pending requests: ${--pendingRequests}`)\n  return value\n}\n\nconst limitedGetChuckNorrisJoke = limitConcur(4, getChuckNorrisJoke)\n\n// At most 4 requests are pending at any given time!\nconst jokes = await Promise.all(categories.map(limitedGetChuckNorrisJoke))\nconsole.log(jokes)\n//=\u003e pending requests: 1\n//=\u003e pending requests: 2\n//=\u003e pending requests: 3\n//=\u003e pending requests: 4\n//=\u003e pending requests: 3\n//=\u003e pending requests: 4\n//=\u003e ...\n//=\u003e pending requests: 3\n//=\u003e pending requests: 2\n//=\u003e pending requests: 1\n//=\u003e pending requests: 0\n//=\u003e [\n//     'Chuck Norris once rode a nine foot grizzly bear through an automatic car wash, instead of taking a shower.',\n//     \"Chuck Norris is actually the front man for Apple. He let's Steve Jobs run the show when he's on a mission. Chuck Norris is always on a mission.\",\n//     \"Bill Gates thinks he's Chuck Norris. Chuck Norris actually laughed. Once.\",\n//     'Chuck Norris can install iTunes without installing Quicktime.',\n//     ...\n//   ]\n```\n\n### Recipes\n\n#### Replacing [`p-map`](https://github.com/sindresorhus/p-map)\n\n```js\nimport limitConcur from 'limit-concur'\n\nconst urls = [`https://tomeraberba.ch`, `https://lfi.dev`, `https://npmjs.com`]\n\nconst mapper = async url =\u003e {\n  const { redirected } = await fetch(url, { method: `head` })\n  return redirected\n}\n\nconst results = await Promise.all(urls.map(limitConcur(2, mapper)))\nconsole.log(results)\n//=\u003e [ false, false, true ]\n```\n\n#### Replacing [`p-all`](https://github.com/sindresorhus/p-all)\n\n```js\nimport limitConcur from 'limit-concur'\n\nconst actions = [\n  () =\u003e fetch(`https://tomeraberba.ch`),\n  () =\u003e fetch(`https://lfi.dev`),\n  () =\u003e checkSomething(),\n  () =\u003e doSomethingElse(),\n]\n\nconst results = await Promise.all(\n  actions.map(limitConcur(2, action =\u003e action())),\n)\nconsole.log(results)\n//=\u003e [ ..., ..., ... ]\n```\n\n#### Replacing [`p-limit`](https://github.com/sindresorhus/p-limit)\n\n```js\nimport limitConcur from 'limit-concur'\n\nconst limit = limitConcur(1, fn =\u003e fn())\n\nconst input = [\n  limit(() =\u003e fetchSomething(`foo`)),\n  limit(() =\u003e fetchSomething(`bar`)),\n  limit(() =\u003e doSomething()),\n]\n\nconst results = await Promise.all(input)\nconsole.log(results)\n//=\u003e [ ..., ..., ... ]\n```\n\n#### Replacing [`p-filter`](https://github.com/sindresorhus/p-filter)\n\n```js\nimport limitConcur from 'limit-concur'\n\nconst urls = [`https://tomeraberba.ch`, `https://lfi.dev`, `https://npmjs.com`]\n\nconst filterer = async url =\u003e {\n  const { redirected } = await fetch(url, { method: `head` })\n  return !redirected\n}\n\nconst results = await Promise.all(\n  urls.map(limitConcur(2, async url =\u003e ({ url, keep: await filterer(url) }))),\n)\nconst filtered = results.flatMap(({ url, keep }) =\u003e (keep ? [url] : []))\nconsole.log(filtered)\n//=\u003e [ 'https://tomeraberba.ch', 'https://lfi.dev' ]\n```\n\n#### Replacing [`p-props`](https://github.com/sindresorhus/p-props)\n\n```js\nimport limitConcur from 'limit-concur'\n\nconst urls = {\n  tomer: `https://tomeraberba.ch`,\n  lfi: `https://lfi.dev`,\n  npm: `https://npmjs.com`,\n}\n\nconst mapper = async url =\u003e {\n  const { redirected } = await fetch(url, { method: `head` })\n  return redirected\n}\n\nconst results = Object.fromEntries(\n  await Promise.all(\n    Object.entries(urls).map(\n      limitConcur(2, async ([name, url]) =\u003e [name, await mapper(url)]),\n    ),\n  ),\n)\nconsole.log(results)\n//=\u003e { tomer: false, lfi: false, npm: true }\n```\n\n## Contributing\n\nStars are always welcome!\n\nFor bugs and feature requests,\n[please create an issue](https://github.com/TomerAberbach/limit-concur/issues/new).\n\n## License\n\n[MIT](https://github.com/TomerAberbach/limit-concur/blob/main/license-mit) ©\n[Tomer Aberbach](https://github.com/TomerAberbach) \\\n[Apache 2.0](https://github.com/TomerAberbach/limit-concur/blob/main/license-apache) ©\n[Google](https://github.com/TomerAberbach/limit-concur/blob/main/notice-apache)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomeraberbach%2Flimit-concur","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomeraberbach%2Flimit-concur","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomeraberbach%2Flimit-concur/lists"}