UNPKG

@zkochan/pnpm

Version:

Fast, disk space efficient package manager

119 lines (118 loc) 5.07 kB
{ "_args": [ [ { "raw": "p-map@^1.1.1", "scope": null, "escapedName": "p-map", "name": "p-map", "rawSpec": "^1.1.1", "spec": ">=1.1.1 <2.0.0", "type": "range" }, "/home/zkochan/src/pnpm/packages/pnpm/node_modules/p-every" ] ], "_from": "p-map@>=1.1.1 <2.0.0", "_id": "p-map@1.2.0", "_inCache": true, "_location": "/p-map", "_nodeVersion": "8.4.0", "_npmOperationalInternal": { "host": "s3://npm-registry-packages", "tmp": "tmp/p-map-1.2.0.tgz_1505195035419_0.6017468643840402" }, "_npmUser": { "name": "sindresorhus", "email": "sindresorhus@gmail.com" }, "_npmVersion": "5.4.1", "_phantomChildren": {}, "_requested": { "raw": "p-map@^1.1.1", "scope": null, "escapedName": "p-map", "name": "p-map", "rawSpec": "^1.1.1", "spec": ">=1.1.1 <2.0.0", "type": "range" }, "_requiredBy": [ "/p-every", "/p-filter" ], "_resolved": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz", "_shasum": "e4e94f311eabbc8633a1e79908165fca26241b6b", "_shrinkwrap": null, "_spec": "p-map@^1.1.1", "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/p-every", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "bugs": { "url": "https://github.com/sindresorhus/p-map/issues" }, "dependencies": {}, "description": "Map over promises concurrently", "devDependencies": { "ava": "*", "delay": "^2.0.0", "in-range": "^1.0.0", "random-int": "^1.0.0", "time-span": "^2.0.0", "xo": "*" }, "directories": {}, "dist": { "integrity": "sha512-r6zKACMNhjPJMTl8KcFH4li//gkrXWfbD6feV8l6doRHlzljFWGJ2AP6iKaCJXyZmAUMOPtvbW7EXkbWO/pLEA==", "shasum": "e4e94f311eabbc8633a1e79908165fca26241b6b", "tarball": "https://registry.npmjs.org/p-map/-/p-map-1.2.0.tgz" }, "engines": { "node": ">=4" }, "files": [ "index.js" ], "gitHead": "e0a1c91c00d5509e9f04c6f0392693a452f385f0", "homepage": "https://github.com/sindresorhus/p-map#readme", "keywords": [ "promise", "map", "resolved", "wait", "collection", "iterable", "iterator", "race", "fulfilled", "async", "await", "promises", "concurrently", "concurrency", "parallel", "bluebird" ], "license": "MIT", "maintainers": [ { "name": "sindresorhus", "email": "sindresorhus@gmail.com" } ], "name": "p-map", "optionalDependencies": {}, "readme": "# p-map [![Build Status](https://travis-ci.org/sindresorhus/p-map.svg?branch=master)](https://travis-ci.org/sindresorhus/p-map)\n\n> Map over promises concurrently\n\nUseful when you need to run promise-returning & async functions multiple times with different inputs concurrently.\n\n\n## Install\n\n```\n$ npm install p-map\n```\n\n\n## Usage\n\n```js\nconst pMap = require('p-map');\nconst got = require('got');\n\nconst sites = [\n\tgetWebsiteFromUsername('sindresorhus'), //=> Promise\n\t'ava.li',\n\t'todomvc.com',\n\t'github.com'\n];\n\nconst mapper = el => got.head(el).then(res => res.requestUrl);\n\npMap(sites, mapper, {concurrency: 2}).then(result => {\n\tconsole.log(result);\n\t//=> ['http://sindresorhus.com/', 'http://ava.li/', 'http://todomvc.com/', 'http://github.com/']\n});\n```\n\n\n## API\n\n### pMap(input, mapper, [options])\n\nReturns a `Promise` that is fulfilled when all promises in `input` and ones returned from `mapper` are fulfilled, or rejects if any of the promises reject. The fulfilled value is an `Array` of the fulfilled values returned from `mapper` in `input` order.\n\n#### input\n\nType: `Iterable<Promise|any>`\n\nIterated over concurrently in the `mapper` function.\n\n#### mapper(element, index)\n\nType: `Function`\n\nExpected to return a `Promise` or value.\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 `mapper`.\n\n\n## Related\n\n- [p-all](https://github.com/sindresorhus/p-all) - Run promise-returning & async functions concurrently with optional limited concurrency\n- [p-filter](https://github.com/sindresorhus/p-filter) - Filter promises concurrently\n- [p-times](https://github.com/sindresorhus/p-times) - Run promise-returning & async functions a specific number of times concurrently\n- [p-props](https://github.com/sindresorhus/p-props) - Like `Promise.all()` but for `Map` and `Object`\n- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially\n- [p-queue](https://github.com/sindresorhus/p-queue) - Promise queue with concurrency control\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-map.git" }, "scripts": { "test": "xo && ava" }, "version": "1.2.0" }