{"id":16350793,"url":"https://github.com/kevva/p-every","last_synced_at":"2025-03-21T00:30:50.502Z","repository":{"id":57317393,"uuid":"92235935","full_name":"kevva/p-every","owner":"kevva","description":"Test whether all promises passes a testing function","archived":false,"fork":false,"pushed_at":"2019-03-15T09:22:41.000Z","size":9,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-12T23:32:33.010Z","etag":null,"topics":["async","async-await","async-functions","concurrency","iteration","nodejs","parallel","promise"],"latest_commit_sha":null,"homepage":null,"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/kevva.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}},"created_at":"2017-05-24T01:17:35.000Z","updated_at":"2024-04-05T19:04:44.000Z","dependencies_parsed_at":"2022-08-25T21:11:41.875Z","dependency_job_id":null,"html_url":"https://github.com/kevva/p-every","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fp-every","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fp-every/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fp-every/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kevva%2Fp-every/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kevva","download_url":"https://codeload.github.com/kevva/p-every/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244094274,"owners_count":20397020,"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","async-await","async-functions","concurrency","iteration","nodejs","parallel","promise"],"created_at":"2024-10-11T01:06:19.891Z","updated_at":"2025-03-21T00:30:50.136Z","avatar_url":"https://github.com/kevva.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# p-every [![Build Status](https://travis-ci.org/kevva/p-every.svg?branch=master)](https://travis-ci.org/kevva/p-every)\n\n\u003e Test whether all promises passes a testing function\n\nLike [`Array.every`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every) for promises.\n\n## Install\n\n```\n$ npm install --save p-every\n```\n\n\n## Usage\n\n```js\nconst pEvery = require('p-every');\nconst getContinent = require('get-continent'); // not a real module\n\nconst places = [\n\tgetCapital('Norway').then(info =\u003e info.name),\n\t'Bangkok, Thailand',\n\t'Berlin, Germany',\n\t'Tokyo, Japan'\n];\n\nconst testFunction = async place =\u003e {\n\tconst continent = await getContinent(place);\n\treturn continent === 'europe';\n}\n\n(async () =\u003e {\n\tconst result = await pEvery(places, testFunction);\n\tconsole.log(result);\n\t//=\u003e false\n})();\n```\n\n\n## API\n\n### pEvery(input, testFunction, [options])\n\nReturns a `Promise` that is fulfilled when all promises in `input` and ones returned from `testFunction` are fulfilled, or rejects if any of the promises reject. The fulfilled value is a `boolean` that is `true` if all Promises passed the test and `false` otherwise.\n\n#### input\n\nType: `Iterable\u003cPromise|any\u003e`\n\nIterated over concurrently in the `testFunction` function.\n\n#### testFunction(element, index)\n\nType: `Function`\n\nPredicate function, expected to return a `Promise\u003cboolean\u003e` or `boolean`.\n\n#### options\n\nType: `Object`\n\n##### concurrency\n\nType: `number`\u003cbr\u003e\nDefault: `Infinity`\u003cbr\u003e\nMinimum: `1`\n\nNumber of concurrently pending promises returned by `testFunction`.\n\n\n## Related\n\n* [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently\n* [p-locate](https://github.com/sindresorhus/p-locate) - Get the first fulfilled promise that satisfies the provided testing function\n* [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently\n* [More…](https://github.com/sindresorhus/promise-fun)\n\n\n## License\n\nMIT © [Kevin Martensson](http://github.com/kevva)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevva%2Fp-every","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkevva%2Fp-every","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkevva%2Fp-every/lists"}