UNPKG

pnpm

Version:

Fast, disk space efficient package manager

124 lines (123 loc) 6 kB
{ "_args": [ [ { "raw": "p-filter@2.1.0", "scope": null, "escapedName": "p-filter", "name": "p-filter", "rawSpec": "2.1.0", "spec": "2.1.0", "type": "version" }, "/home/zoltan/src/pnpm/pnpm/packages/pnpm" ] ], "_from": "p-filter@2.1.0", "_hasShrinkwrap": false, "_id": "p-filter@2.1.0", "_location": "/p-filter", "_nodeVersion": "8.15.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/p-filter_2.1.0_1554353650849_0.39423971424215853" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "6.9.0", "_phantomChildren": {}, "_requested": { "raw": "p-filter@2.1.0", "scope": null, "escapedName": "p-filter", "name": "p-filter", "rawSpec": "2.1.0", "spec": "2.1.0", "type": "version" }, "_requiredBy": [ "/", "/@pnpm/link-bins", "/@pnpm/package-bins", "/@pnpm/package-store", "/find-packages", "/remove-all-except-outer-links", "/supi" ], "_resolved": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", "_shasum": "1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c", "_shrinkwrap": null, "_spec": "p-filter@2.1.0", "_where": "/home/zoltan/src/pnpm/pnpm/packages/pnpm", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/p-filter/issues" }, "dependencies": { "p-map": "^2.0.0" }, "description": "Filter promises concurrently", "devDependencies": { "ava": "^1.4.1", "tsd": "^0.7.2", "xo": "^0.24.0" }, "directories": {}, "dist": { "integrity": "sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==", "shasum": "1b1472562ae7a0f742f0f3d3d3718ea66ff9c09c", "tarball": "https://registry.npmjs.org/p-filter/-/p-filter-2.1.0.tgz", "fileCount": 5, "unpackedSize": 5814, "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpY3zCRA9TVsSAnZWagAA/1sQAKEdQuE5Npl/MTleGZ1b\nDn9Ob03f6lNyHKf6PNRyt5ejPiLehCWclLH7q9ZVLb7Wp7sLC4ruWQ6JF7W0\nnkDK45WLUs7WnTYTqoR3O4ysDIZ/tG1DxYlmHUOdMPgFNKx+dmgT3a0y3gmO\n63qr/8HDPcxnwJ7ntRYAyzQXEvBKH8+4VTds+NuwfN0mN1VLNbsyYi0ZNuM3\nk420zl9Yd2nlsr4SDt+9Nu6bQZRYlPIkrvDtbgM5Ai/6Ci3r3NPAkFWIBwib\nA/tWT+7tlMB7ZvLwKDrFKY89MXAcLLQmVG/HpQFGHsS7aJfDCFXUmtNCLipY\nu3jd16Z861vTL6F+QmB85HFuL/waIfpcUcwMb/sLZwWyiK6uSJB5SniSypMv\nwKUhQAN5j+Dh4mw4p57VQdngyjeoxmP06kxC9QnR0O8PKCu+VB/WpRD0APHE\ns+dKyBoWyBz2MpQwMUrB9LneqdFUQU0WQXf1B2Dit0Yq49PeQqUF1KFMO4G1\ndIArmlpcw3+CpVZNgoWDcXNwWT3xkWZxGR5a/rpqbxJAtXsunZNJm8f2BYii\nF1vz2TgebrU9USnxR84o7ey1JDUXiXA6pvWv0gOzDHwoKLJeqdZup7h5/nyG\ncPH+XXh8iLi+f5pcUXb+exg5wpR68uCGX7fE+36rXz2z96fkWGOEU2kiIZ1L\n1hTL\r\n=X45i\r\n-----END PGP SIGNATURE-----\r\n" }, "engines": { "node": ">=8" }, "files": [ "index.js", "index.d.ts" ], "gitHead": "095943f96513f7eb5da9b9ae944344fe954af82d", "homepage": "https://github.com/sindresorhus/p-filter#readme", "keywords": [ "promise", "filter", "collection", "iterable", "iterator", "fulfilled", "async", "await", "promises", "concurrently", "concurrency", "parallel", "bluebird" ], "license": "MIT", "maintainers": [ { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "name": "p-filter", "optionalDependencies": {}, "readme": "# p-filter [![Build Status](https://travis-ci.org/sindresorhus/p-filter.svg?branch=master)](https://travis-ci.org/sindresorhus/p-filter)\n\n> Filter promises concurrently\n\nUseful when you need to run promise-returning & async functions multiple times with different inputs concurrently and get a filtered down result.\n\n\n## Install\n\n```\n$ npm install p-filter\n```\n\n\n## Usage\n\n```js\nconst pFilter = require('p-filter');\nconst getWeather = require('get-weather'); // not a real module\n\nconst places = [\n\tgetCapital('Norway').then(info => info.name),\n\t'Bangkok, Thailand',\n\t'Berlin, Germany',\n\t'Tokyo, Japan'\n];\n\nconst filterer = async place => {\n\tconst weather = await getWeather(place);\n\treturn weather.temperature > 30;\n};\n\n(async () => {\n\tconst result = await pFilter(places, filterer);\n\n\tconsole.log(result);\n\t//=> ['Bangkok, Thailand']\n})();\n```\n\n\n## API\n\n### pFilter(input, filterer, [options])\n\nReturns a `Promise` that is fulfilled when all promises in `input` and ones returned from `filterer` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `filterer` in `input` order.\n\n#### input\n\nType: `Iterable<Promise|any>`\n\nIterated over concurrently in the `filterer` function.\n\n#### filterer(element, index)\n\nType: `Function`\n\nThe filterer function that decides whether an element should be included into result. Expected to return `boolean | Promise<boolean>`.\n\n#### options\n\nType: `Object`\n\n##### concurrency\n\nType: `number`<br>\nDefault: `Infinity`<br>\nMinimum: `1`\n\nNumber of concurrently pending promises returned by `filterer`.\n\n\n## Related\n\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- [p-times](https://github.com/sindresorhus/p-times) - Run promise-returning & async functions a specific number of times concurrently\n- [More…](https://github.com/sindresorhus/promise-fun)\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n", "readmeFilename": "readme.md", "repository": { "type": "git", "url": "git+https://github.com/sindresorhus/p-filter.git" }, "scripts": { "test": "xo && ava && tsd" }, "version": "2.1.0" }