{"id":24774965,"url":"https://github.com/marcelowa/promise-all-properties","last_synced_at":"2025-10-12T00:31:11.489Z","repository":{"id":11915257,"uuid":"70789494","full_name":"marcelowa/promise-all-properties","owner":"marcelowa","description":"A helper function that recevies an object with a promise in each property and returns a promise that resolves to an object with the same properties and the resolved values of the promises","archived":false,"fork":false,"pushed_at":"2024-06-25T10:50:17.000Z","size":161,"stargazers_count":28,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-08T22:12:28.175Z","etag":null,"topics":["javascript","promise","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcelowa.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":"2016-10-13T09:14:08.000Z","updated_at":"2024-09-07T02:19:02.000Z","dependencies_parsed_at":"2024-06-18T20:03:49.282Z","dependency_job_id":"a47b51cd-b1c4-4fec-98fe-3075c9486a33","html_url":"https://github.com/marcelowa/promise-all-properties","commit_stats":{"total_commits":56,"total_committers":6,"mean_commits":9.333333333333334,"dds":0.2142857142857143,"last_synced_commit":"bef660692a204c87caa236ed68174204039cdcfa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelowa%2Fpromise-all-properties","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelowa%2Fpromise-all-properties/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelowa%2Fpromise-all-properties/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcelowa%2Fpromise-all-properties/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcelowa","download_url":"https://codeload.github.com/marcelowa/promise-all-properties/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236141846,"owners_count":19101609,"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":["javascript","promise","typescript"],"created_at":"2025-01-29T06:31:30.375Z","updated_at":"2025-10-12T00:31:06.203Z","avatar_url":"https://github.com/marcelowa.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Promise all properties\n[![tests](https://github.com/marcelowa/promise-all-properties/actions/workflows/ci.yaml/badge.svg)](https://github.com/marcelowa/promise-all-properties/actions/workflows/ci.yaml)\n\nA helper function that receives an object with a [Promise] in each property and returns a promise that resolves to an object with the same properties and the resolved values of the promises.  \n\nThe returned promise is rejected in the following cases:  \n1. The input argument is not an \"object\"  \n2. At least one of the promises are rejected  \n\n[Promise]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise\n\n## Requirements\n* ES6 Promise supporting Javascript engine (browser or Node.js), or at least an ES6 Promise polyfill\n* a node package manager installed (such as NPM or Yarn)\n\n## Usage example (ES6/Typescript):\n\n```javascript\nimport promiseAllProperties from 'promise-all-properties';\n\nconst promisesObject = {\n  someProperty: Promise.resolve('resolve value'),\n  anotherProperty: Promise.resolve('another resolved value'),\n};\n\nconst promise = promiseAllProperties(promisesObject);\n\npromise.then((resolvedObject) =\u003e {\n  console.log(resolvedObject);\n  // {\n  //   someProperty: 'resolve value',\n  //   anotherProperty: 'another resolved value'\n  // }\n});\n\n```\n\n## Promise all settled properties\n\nThis helper function works the same as `promiseAllProperties`, except it uses [`Promise.allSettled`][allSettled] instead of [`Promise.all`][all]. It is therefore possible to get the status of all the promises, regardless of how many of them were fulfilled or rejected.\n\nUsage example:\n\n```javascript\nimport {promiseAllSettledProperties} from 'promise-all-properties';\n\nconst promisesObject = {\n  someProperty: Promise.resolve('resolve value'),\n  anotherProperty: Promise.reject(new Error('a rejection')),\n  yetAnotherProperty: Promise.reject(new Error('another rejection')),\n};\n\nconst promise = promiseAllSettledProperties(promisesObject);\n\npromise.then((resolvedObject) =\u003e {\n  console.log(resolvedObject);\n  // {\n  //   someProperty: {status: 'fulfilled', value: 'resolve value'},\n  //   anotherProperty: {status: 'rejected', reason: Error('a rejection')},\n  //   yetAnotherProperty: {status: 'rejected', reason: Error('another rejection')}\n  // }\n});\n\n// By comparison, promiseAllProperties(promisesObject) would reject with Error('a rejection')\n```\n\n[allSettled]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled\n[all]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all\n\n## Breaking changes\n\n### v4.0.0\n- Minimum Node.js version is now 12.20.0 to support the promiseAllSettledProperties method\n\n### v3.0.0\n\n- Passing an Array of values causes the promise to be rejected as invalid\n- Stricter TypeScript signature now errors on non-object arguments.\n\n## Developers\n\n### Run tests:\n```bash\nnpm test\n```\n\n### Build:\n```bash\nnpm run build\n```\n\n### Contributions:\nPR's are welcome just make sure the the PR is squashed (one commit) and the commit messages starts with one of the following prefixes:  \n\n`[INITIAL]`: The initial commit  \n`[FEAT]`: Only changes that creating new features or modofying existing features, that are not bug fixes  \n`[FIX]`: Only bug fixes  \n`[DOCS]`: Only Documentation changes  \n`[STYLE]`: Only changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)  \n`[REFACTOR]`: Only code changes that are neither fixes or features  \n`[TEST]`: Only changes that are adding new tests or modifying existing tests  \n`[TOOLS]`: Only changes that affect external processeses like build tools, dev tools, auxiliary tools and libraries such as documentation generation  \n`[CLEANUP]`: Only code removal: code lines, comment lines or files without affecting the project whatsoever  \n\n## License\nPublic domain [Unlicense][unlicense]\n\n\n[unlicense]: http://unlicense.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelowa%2Fpromise-all-properties","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcelowa%2Fpromise-all-properties","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcelowa%2Fpromise-all-properties/lists"}