{
	"name": "p-reduce",
	"versions": {
		"1.0.0": {
			"name": "p-reduce",
			"version": "1.0.0",
			"description": "Reduce a list of values using promises into a promise for a value",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/sindresorhus/p-reduce.git"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "sindresorhus.com"
			},
			"engines": {
				"node": ">=4"
			},
			"scripts": {
				"test": "xo && ava"
			},
			"files": [
				"index.js"
			],
			"keywords": [
				"promise",
				"reduce",
				"collection",
				"iterable",
				"iterator",
				"async",
				"await",
				"promises",
				"accumulate",
				"bluebird"
			],
			"devDependencies": {
				"ava": "*",
				"delay": "^1.3.1",
				"xo": "*"
			},
			"xo": {
				"esnext": true
			},
			"gitHead": "fa526a9b6b51a3c4811c61954328218a4636871d",
			"bugs": {
				"url": "https://github.com/sindresorhus/p-reduce/issues"
			},
			"homepage": "https://github.com/sindresorhus/p-reduce#readme",
			"_id": "p-reduce@1.0.0",
			"_shasum": "18c2b0dd936a4690a529f8231f58a0fdb6a47dfa",
			"_from": ".",
			"_npmVersion": "2.15.9",
			"_nodeVersion": "4.6.0",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"dist": {
				"shasum": "18c2b0dd936a4690a529f8231f58a0fdb6a47dfa",
				"tarball": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"_npmOperationalInternal": {
				"host": "packages-12-west.internal.npmjs.com",
				"tmp": "tmp/p-reduce-1.0.0.tgz_1477023867894_0.5352144201751798"
			},
			"directories": {},
			"contributors": []
		},
		"2.0.0": {
			"name": "p-reduce",
			"version": "2.0.0",
			"description": "Reduce a list of values using promises into a promise for a value",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/sindresorhus/p-reduce.git"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "sindresorhus.com"
			},
			"engines": {
				"node": ">=8"
			},
			"scripts": {
				"test": "xo && ava && tsd-check"
			},
			"keywords": [
				"promise",
				"reduce",
				"collection",
				"iterable",
				"iterator",
				"async",
				"await",
				"promises",
				"accumulate",
				"bluebird"
			],
			"devDependencies": {
				"ava": "^1.3.1",
				"delay": "^4.1.0",
				"tsd-check": "^0.3.0",
				"xo": "^0.24.0"
			},
			"gitHead": "44439fb758f74506b45863488abef8d3d8762629",
			"bugs": {
				"url": "https://github.com/sindresorhus/p-reduce/issues"
			},
			"homepage": "https://github.com/sindresorhus/p-reduce#readme",
			"_id": "p-reduce@2.0.0",
			"_nodeVersion": "8.15.0",
			"_npmVersion": "6.9.0",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"dist": {
				"integrity": "sha512-VcNNEqiYIkRCGeUHELY5dUrnQHCRwL6eIH/L9oSbl/PsvyHQXD1ws/MFwuEb+6dgH/URCfROVUqOYL37eHi2kQ==",
				"shasum": "365a26916213650711124881a6bdc4e32c2bfe36",
				"tarball": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.0.0.tgz",
				"fileCount": 5,
				"unpackedSize": 5183,
				"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchz/HCRA9TVsSAnZWagAApiEP/RrtDqK03NEBn7aHLY9d\nSYDyQcbfqGD8d57l79luuRIFlk325el+A3PQ0DMz9w+yEkaTDFCDGXlUdwSY\nRN6wUr71jne7GcvL00eHmnjxZLmqgGBZm3BF4345+x7HI+G6knVzGURxdgWe\nL0KYFCuhcg3jbSxJCt3UrAfj5Y5fQZmTOETtHKlDV2S0DXuHqtiUr2Wch4a9\nQ1qj0lRqsDDcZU5qbKyZnBn8i5rNbS3NaY0bVNYJHlzlQQ3laLKfHxTpNQDk\nWgkwRbSAefldtiD9Yom0qT7AxA2XJAR7XMlESMyJCNSsNSOElssZ8HMbp4bs\nBmgzL3cH3qIZC/LUa1DjV1xxt4jwQsSnCvQXUM9rtTZ049yJ8VYrhXcqb7u3\nlRpBLHDxYWAIIhDQdZXa9IjDE1W8D4Kyf8KQHR4UXxEvKKh8TWmTKqLsq77t\nLX0vcc8lwhvmjIvsMuerWpEtLHM7E3BQ0PXmBBc+Ygo+f3AmTuAEvxZCH/tN\nbuUotTorGG3N5aboPQ7RKmIyhJa38FKt0hk6d4FJ6FJSzRJvpK39qZ09es5G\ndI8V5lF0pnh4kWHpYTvRAPnSaPin5LeyF/LHZJOx+qS3AB33KDcq0hgq2uQK\nqm+EBQ/WGdpqATtSvOjNTqiLMePesojjEgu4GfAtU+cNO9aM2RuNr0Xxxnc8\n335Y\r\n=BDJY\r\n-----END PGP SIGNATURE-----\r\n"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"directories": {},
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/p-reduce_2.0.0_1552367558654_0.1055260822991213"
			},
			"_hasShrinkwrap": false,
			"contributors": []
		},
		"2.1.0": {
			"name": "p-reduce",
			"version": "2.1.0",
			"description": "Reduce a list of values using promises into a promise for a value",
			"license": "MIT",
			"repository": {
				"type": "git",
				"url": "git+https://github.com/sindresorhus/p-reduce.git"
			},
			"author": {
				"name": "Sindre Sorhus",
				"email": "sindresorhus@gmail.com",
				"url": "sindresorhus.com"
			},
			"engines": {
				"node": ">=8"
			},
			"scripts": {
				"test": "xo && ava && tsd"
			},
			"keywords": [
				"promise",
				"reduce",
				"collection",
				"iterable",
				"iterator",
				"async",
				"await",
				"promises",
				"accumulate",
				"bluebird"
			],
			"devDependencies": {
				"ava": "^1.4.1",
				"delay": "^4.1.0",
				"tsd": "^0.7.2",
				"xo": "^0.24.0"
			},
			"gitHead": "cb9d053d05194221f010fcd0dfa9d0c203aa26d7",
			"bugs": {
				"url": "https://github.com/sindresorhus/p-reduce/issues"
			},
			"homepage": "https://github.com/sindresorhus/p-reduce#readme",
			"_id": "p-reduce@2.1.0",
			"_nodeVersion": "8.15.0",
			"_npmVersion": "6.9.0",
			"_npmUser": {
				"name": "sindresorhus",
				"email": "sindresorhus@gmail.com"
			},
			"dist": {
				"integrity": "sha512-2USApvnsutq8uoxZBGbbWM0JIYLiEMJ9RlaN7fAzVNb9OZN0SHjjTTfIcb667XynS5Y1VhwDJVDa72TnPzAYWw==",
				"shasum": "09408da49507c6c274faa31f28df334bc712b64a",
				"tarball": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz",
				"fileCount": 5,
				"unpackedSize": 6142,
				"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpY7KCRA9TVsSAnZWagAA7TUP/Rbv3p69jzfUtG/DOBw7\n5J6zxfGm2lYrNcR9L7bvKXR4RQHKrQqHayNeBumJ87mFiexk3C1PXTxc/193\n4TZ09LIHCZsv7RtA311qvsmRzlcxjZI6VSKNBUztoBhe8JDgZT3j1IVxQ3Bh\njN7ABBofo7y1tbi4arRJ6A49n7e9GvbBNoqyP80Fq+O+rN75zLDFfV6l06wx\n/JPcepVpgyJInCU4bsts7pO86WVQZswDX19WcKn1cjX09Mt+Yk7krSy0DajX\njKDWRNkxUOPw+16cdUhAH6pLAdv6Zr6ZB42vNAIw75U8Zi1AiihJrZ6DQPi6\nJv5FxqqlhRAR4aQt62M4WEQmPhvOunegY8LmT6j7GEBO+rCOk+CyyqXo4NiV\nJcOTjGncKkn17qqNS+wZXK1+U3UMb0Pifu+rdz2/TMWQq3QkHpTwXmKTe4FG\nI8HZAKCZ/IdO4QSUquhPN0x8PFo9s6BuUUkcm+fAc1dcV109dcG/Psp1WSC+\n3rg2cNh/zQDhjv2/XMYt1LZa6sBFkGKQ2yTO2lAUlXapGrpI2aPvRIb3JPzP\nU5HElYWEHeJCLdTCRQhtyO3B0Ep1s/NWLuc1BtZkXPvIP1O9w7t44x//tgAm\n4NE4eDqKL/zcuHDo1kv5/qc+AE6PSK4qg47VtN8r5Wu9Yx4akheqT/gZQlIg\ngQal\r\n=uxuQ\r\n-----END PGP SIGNATURE-----\r\n"
			},
			"maintainers": [
				{
					"name": "sindresorhus",
					"email": "sindresorhus@gmail.com"
				}
			],
			"directories": {},
			"_npmOperationalInternal": {
				"host": "s3://npm-registry-packages",
				"tmp": "tmp/p-reduce_2.1.0_1554353865830_0.3691561520970803"
			},
			"_hasShrinkwrap": false,
			"contributors": []
		}
	},
	"time": {
		"modified": "2019-04-04T04:57:48.909Z",
		"created": "2016-10-21T04:24:28.119Z",
		"1.0.0": "2016-10-21T04:24:28.119Z",
		"2.0.0": "2019-03-12T05:12:38.774Z",
		"2.1.0": "2019-04-04T04:57:45.948Z"
	},
	"users": {},
	"dist-tags": {
		"latest": "2.1.0"
	},
	"_uplinks": {
		"npmjs": {
			"etag": "W/\"19a420460e8e54fae9f3482d55fa9210\"",
			"fetched": 1593324426804
		}
	},
	"_distfiles": {
		"p-reduce-1.0.0.tgz": {
			"url": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
			"sha": "18c2b0dd936a4690a529f8231f58a0fdb6a47dfa",
			"registry": "npmjs"
		},
		"p-reduce-2.0.0.tgz": {
			"url": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.0.0.tgz",
			"sha": "365a26916213650711124881a6bdc4e32c2bfe36",
			"registry": "npmjs"
		},
		"p-reduce-2.1.0.tgz": {
			"url": "https://registry.npmjs.org/p-reduce/-/p-reduce-2.1.0.tgz",
			"sha": "09408da49507c6c274faa31f28df334bc712b64a",
			"registry": "npmjs"
		}
	},
	"_attachments": {
		"p-reduce-1.0.0.tgz": {
			"shasum": "18c2b0dd936a4690a529f8231f58a0fdb6a47dfa"
		}
	},
	"_rev": "2-4025e546765fb506",
	"_id": "p-reduce",
	"readme": "# p-reduce [![Build Status](https://travis-ci.org/sindresorhus/p-reduce.svg?branch=master)](https://travis-ci.org/sindresorhus/p-reduce)\n\n> Reduce a list of values using promises into a promise for a value\n\nUseful when you need to calculate some accumulated value based on async resources.\n\n\n## Install\n\n```\n$ npm install p-reduce\n```\n\n\n## Usage\n\n```js\nconst pReduce = require('p-reduce');\nconst humanInfo = require('human-info'); // Not a real module\n\n(async () => {\n\tconst names = [\n\t\tgetUser('sindresorhus').then(info => info.name),\n\t\t'Addy Osmani',\n\t\t'Pascal Hartig',\n\t\t'Stephen Sawchuk'\n\t];\n\n\tconst totalAge = await pReduce(names, async (total, name) => {\n\t\tconst info = await humanInfo(name);\n\t\treturn total + info.age;\n\t}, 0);\n\n\tconsole.log(totalAge);\n\t//=> 125\n})();\n```\n\n\n## API\n\n### pReduce(input, reducer, [initialValue])\n\nReturns a `Promise` that is fulfilled when all promises in `input` and ones returned from `reducer` are fulfilled, or rejects if any of the promises reject. The fulfilled value is the result of the reduction.\n\n#### input\n\nType: `Iterable<Promise|any>`\n\nIterated over serially in the `reducer` function.\n\n#### reducer(previousValue, currentValue, index)\n\nType: `Function`\n\nExpected to return a value. If a `Promise` is returned, it's awaited before continuing with the next iteration.\n\n#### initialValue\n\nType: `unknown`\n\nValue to use as `previousValue` in the first `reducer` invocation.\n\n\n## Related\n\n- [p-each-series](https://github.com/sindresorhus/p-each-series) - Iterate over promises serially\n- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially\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)"
}