UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

120 lines (119 loc) 4.55 kB
{ "_args": [ [ { "raw": "p-filter@1.0.0", "scope": null, "escapedName": "p-filter", "name": "p-filter", "rawSpec": "1.0.0", "spec": "1.0.0", "type": "version" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/package-store" ] ], "_from": "p-filter@1.0.0", "_id": "p-filter@1.0.0", "_inCache": true, "_location": "/p-filter", "_nodeVersion": "4.6.0", "_npmOperationalInternal": { "host": "packages-18-east.internal.npmjs.com", "tmp": "tmp/p-filter-1.0.0.tgz_1477023370757_0.32707744953222573" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "2.15.9", "_phantomChildren": {}, "_requested": { "raw": "p-filter@1.0.0", "scope": null, "escapedName": "p-filter", "name": "p-filter", "rawSpec": "1.0.0", "spec": "1.0.0", "type": "version" }, "_requiredBy": [ "/@pnpm/link-bins", "/@pnpm/package-bins", "/find-packages", "/package-store", "/remove-all-except-outer-links", "/supi" ], "_resolved": "https://registry.npmjs.org/p-filter/-/p-filter-1.0.0.tgz", "_shasum": "629d317150209c8fd508ba137713ef4bb920e9db", "_shrinkwrap": null, "_spec": "p-filter@1.0.0", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/package-store", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/p-filter/issues" }, "dependencies": { "p-map": "^1.0.0" }, "description": "Filter promises concurrently", "devDependencies": { "ava": "*", "xo": "*" }, "directories": {}, "dist": { "shasum": "629d317150209c8fd508ba137713ef4bb920e9db", "tarball": "https://registry.npmjs.org/p-filter/-/p-filter-1.0.0.tgz" }, "engines": { "node": ">=4" }, "files": [ "index.js" ], "gitHead": "92325d87416a43dac04fdc32b9e9a86fbd5171ac", "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 --save 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 = el => getWeather(el).then(place => place.temperature > 30);\n\npFilter(places, filterer).then(result => {\n\tconsole.log(result);\n\t//=> [{name: 'Bangkok, Thailand', temperature: 36}]\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\nExpected to return a `boolean` or a `Promise` for a `boolean`.\n\n#### options\n\nType: `Object`\n\n##### concurrency\n\nType: `number`<br>\nDefault: `Infinity`\n\nNumber of concurrently pending promises returned by `filterer`. Minimum `1`.\n\n\n## Related\n\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 © [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" }, "version": "1.0.0", "xo": { "esnext": true } }