{"id":19301208,"url":"https://github.com/siddhesh-coder/promise-apis","last_synced_at":"2026-06-13T18:36:54.114Z","repository":{"id":208663756,"uuid":"722137338","full_name":"siddhesh-coder/Promise-APIs","owner":"siddhesh-coder","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-08T18:11:37.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T01:38:53.522Z","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/siddhesh-coder.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-22T14:11:14.000Z","updated_at":"2023-11-22T16:13:52.000Z","dependencies_parsed_at":"2023-11-22T17:30:04.345Z","dependency_job_id":"303ae160-af22-42c1-a4dd-856a5dd4048a","html_url":"https://github.com/siddhesh-coder/Promise-APIs","commit_stats":null,"previous_names":["siddhesh-coder/promise-apis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/siddhesh-coder/Promise-APIs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-coder%2FPromise-APIs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-coder%2FPromise-APIs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-coder%2FPromise-APIs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-coder%2FPromise-APIs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siddhesh-coder","download_url":"https://codeload.github.com/siddhesh-coder/Promise-APIs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siddhesh-coder%2FPromise-APIs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34296380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"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":[],"created_at":"2024-11-09T23:17:09.006Z","updated_at":"2026-06-13T18:36:54.099Z","avatar_url":"https://github.com/siddhesh-coder.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Promise-APIs\n\n## 1. Promise.all([])\n\n- It takes an array of promises as an input \"iterable\".\n- Example: `Promise.all([p1, p2, p3])`.\n\n### Success Case:\n\n- Suppose `p1`, `p2`, `p3` take time `3s`, `1s`, `2s` to complete. If all get resolved, it will \n  give the result in the array `[val1, val2, val3]`.\n- Time taken: It will take 3s (because `p1` takes the most time 3s).\n- It will wait for all of them to finish.\n\n### Reject Case:\n\n- Suppose after 1s, `p2` gets rejected. As soon as any of the promises get rejected, `Promise.all` \n  will throw an immediate error of that same failed promise.\n- It will not wait for other promises.\n\n## 2. Promise.allSettled([])\n\n- If you have no problem with even promise being rejected, then use this. (you want both the cases \n  to happen)\n- If `p2` gets rejected, wait for all promises to settle. After 3s, the output will be `[{val1}, \n  {err2}, {val3}]`.\n\n## 3. Promise.race([])\n\n- This races between all the promises whichever of them gets settled first, the promise will give \n  the success or failure based on the race winning promise.\n- Example: `Promise.race([p1, p2, p3])` for time `3s`, `2s`, `4s`. In this case, `2s` will settle \n  first.\n\n## 4. Promise.any([])\n\n- It will wait for the first success, searching for the first success.\n\n\n## Note:\n- If all fail, it will throw an `AggregateError`, and if you want an array of errors `[err1, err2, \n  err3]`, then use `console.log(err.errors)`.\n\n\n## Meaning of Settled:\n![Local Image](Screenshot%20(180).png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhesh-coder%2Fpromise-apis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddhesh-coder%2Fpromise-apis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddhesh-coder%2Fpromise-apis/lists"}