{"id":16940487,"url":"https://github.com/spencermountain/slow","last_synced_at":"2025-03-22T12:32:30.326Z","repository":{"id":5018660,"uuid":"6177315","full_name":"spencermountain/slow","owner":"spencermountain","description":"whoa easy there javascript","archived":false,"fork":false,"pushed_at":"2023-01-04T21:42:29.000Z","size":260,"stargazers_count":6,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-26T10:20:17.217Z","etag":null,"topics":["async","control-flow","maplimit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"yamatt/slm-api","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spencermountain.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":"2012-10-11T16:54:26.000Z","updated_at":"2022-01-25T07:06:00.000Z","dependencies_parsed_at":"2023-01-13T13:20:12.843Z","dependency_job_id":null,"html_url":"https://github.com/spencermountain/slow","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/spencermountain%2Fslow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencermountain%2Fslow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencermountain%2Fslow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spencermountain%2Fslow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spencermountain","download_url":"https://codeload.github.com/spencermountain/slow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244959444,"owners_count":20538625,"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","control-flow","maplimit"],"created_at":"2024-10-13T21:07:10.842Z","updated_at":"2025-03-22T12:32:30.034Z","avatar_url":"https://github.com/spencermountain.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://cloud.githubusercontent.com/assets/399657/23590290/ede73772-01aa-11e7-8915-181ef21027bc.png\" /\u003e\n  \u003cdiv\u003ekeep your pants on, javascript\u003c/div\u003e\n  \u003ca href=\"https://npmjs.org/package/slow\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/slow.svg?style=flat-square\" /\u003e\n  \u003c/a\u003e\n  \u003cdiv\u003e\u003ccode\u003enpm install slow\u003c/code\u003e\u003c/div\u003e\n\u003c/div\u003e\n\nRun a function in parallel, without going too fast.\n\nGive it `an array`, and `a function` that returns a Promise.\n\nthen it tells you when it's done.\n\nuseful for courteous use of a web-service, or avoiding a blown-stack.\n\n```js\nconst slow = require('slow')\n\nconst randomWait = i =\u003e {\n  return new Promise(resolve =\u003e {\n    setTimeout(() =\u003e resolve(i), Math.random() * 3000)\n  })\n}\nslow.walk([1, 2, 3, 4, 5, 6], randomWait).then(res =\u003e {\n  console.log('done!')\n  console.log(res) //[1,2,3,4,5,6]\n})\n```\n\nor, if you prefer, as `async/await`\n\n```js\n;(async () =\u003e {\n  let res = await slow.walk(['larry', 'curly', 'moe'], randomWait)\n  // ['larry', 'curly', 'moe']\n})()\n```\n\nresults are always in order.\n\none bad async call will not throw the whole operation, either.\n\n#### Methods:\n\n- **slow.crawl(arr, fn)** - max 3\n- **slow.walk(arr, fn)** - max 5\n- **slow.run(arr, fn)** - max 10\n- **slow.sprint(arr, fn)** - max 15\n- **slow.one(arr, fn)** - max 1\n- **slow.two(arr, fn)** - max 2\n\n#### In the browser:\n\n```html\n\u003cscript src=\"https://unpkg.com/slow\"\u003e\u003c/script\u003e\n\u003cscript defer\u003e\n  let urls = ['New_York_Yankees', 'Toronto_Blue_Jays', 'Boston_Red_Sox']\n  slow.walk(urls, fetch).then(pages =\u003e {\n    console.log(pages)\n  })\n\u003c/script\u003e\n```\n\n### See also\n\n- [async/maplimit](https://caolan.github.io/async/docs.html#mapLimit)\n- [dbrockman/promise-map-limit](https://github.com/dbrockman/promise-map-limit)\n- [addaleax/promise-ratelimit](https://github.com/addaleax/promise-ratelimit)\n\n  MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspencermountain%2Fslow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspencermountain%2Fslow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspencermountain%2Fslow/lists"}