{"_id":"await-reduce","_rev":"9-5c68f26f74fbecac04a6392d9ab7a125","name":"await-reduce","dist-tags":{"latest":"1.2.3"},"versions":{"1.1.1":{"name":"await-reduce","version":"1.1.1","description":"Reduce array of Promises","author":{"name":"omrilotan"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/omrilotan/mono.git"},"homepage":"https://omrilotan.github.io/mono/await-reduce/","main":"index.js","scripts":{"test":"cd ../../; npm t await-reduce; cd -"},"publishConfig":{"tag":"latest"},"bugs":{"url":"https://github.com/omrilotan/mono/issues"},"_id":"await-reduce@1.1.1","_npmVersion":"5.10.0","_nodeVersion":"10.2.1","_npmUser":{"name":"omrilotan","email":"omri@hamadgera.com"},"dist":{"integrity":"sha512-9d+uZ08KNLpwzFmX203GUxqQuCZYXvTdRzdjSeiIhF1JdyDVlr894hw89fB9jG2yKc4jHyDAAJa3pimkT2IP5Q==","shasum":"d426d046b02e68d1c10e7be746658db301166085","tarball":"https://registry.npmjs.org/await-reduce/-/await-reduce-1.1.1.tgz","fileCount":3,"unpackedSize":3095,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbFXrFCRA9TVsSAnZWagAAkQsP/1toUbA6wLiqIfl1PQCS\nA/gjlF89HTXOdQv6Vaa1bq5ptW4UFOSy6fytHSxefkJBKukGiRTV1n9dipml\nrfAYi206ZDSvNGTwBXro0gfsnbvB5Zv0wAhX7dmZUqAh1y4EKz/Pjn/M4btJ\n8NxA8Rv25uCYFm3Ue/Kl4T3ne01IoCgf3QLeaQjo65lLaCtpcBZIZ1mUb96T\niQhqMxHf0ng78wN+zyWT8fR8MwvHMPgpq/1YffKcRRyzV2UIKp7swWLVHORE\nf9WO3D/x1atV9ovdwn5ufQM/4nV9B6H6fMORJnQeIB4yqPc+Yt2VTA5L6Dph\nlEn64ODBCRqVkZftEmie0z39GThG9nzPAdHkOn3+PFM9mUXsnOv3Ey3a3YP/\nQRxDoyYV6dt2gaBs/jriORiBKRGQ+nSeTQOuQoVqdrQy1x9GyftXYSQxlF1C\nAcyXV75oFJ5d4Yus502iHtSEf/Hl2V1ePySnR9U6EppnfyvjRPm8xTzZ55Pq\nDrd0WiRlrMv2lIP/cJmAtrLj8og+d39QweMNMRFoQ+GfQmRYaWQtoW+4nIDR\nlbiNTytB+DcTnyakfGduOfYIYBpWgcC7YB2E4BnH7PEpq0M+oL9aN+ICkdJk\npmo2+oTrSnSEWGfYk6Jf3IPR2ynu+7tc8aD9WQn1aIlrBpKemmOE9qv7wfGq\nMSjp\r\n=hSea\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICHmATLNwHcECrC2jB+jgaQisj4caXtNu+f7NJ9SvrwMAiEAlG0rXZKSS2cjD/sM5apJt0RLIl4NaT9u5r/Ya01RVLs="}]},"maintainers":[{"name":"omrilotan","email":"omri@hamadgera.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/await-reduce_1.1.1_1528134340364_0.9166671555189094"},"_hasShrinkwrap":false},"1.2.0":{"name":"await-reduce","version":"1.2.0","description":"Resolve and reduce an array of promises","author":{"name":"omrilotan"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/omrilotan/mono.git"},"homepage":"https://omrilotan.com/mono/await-reduce/","main":"index.js","browser":"dist/index.js","scripts":{"dist":"mkdir -p dist; babel index.js --out-file dist/index.js","test":"cd ../../; npm t await-reduce; cd -"},"publishConfig":{"tag":"latest"},"bugs":{"url":"https://github.com/omrilotan/mono/issues"},"_id":"await-reduce@1.2.0","_npmVersion":"6.4.0","_nodeVersion":"10.2.1","_npmUser":{"name":"omrilotan","email":"omri@hamadgera.com"},"dist":{"integrity":"sha512-9bmiJB+NpeLx8rvd4Wzaini1hUg+XSM9baCTxAigjgOHrlJUk0PehaViaoN/njZ0tVb1YNMxnYZ96Hk6WUvUfQ==","shasum":"49e7f91ac2e635147ec71a74727beb7ce0cd942e","tarball":"https://registry.npmjs.org/await-reduce/-/await-reduce-1.2.0.tgz","fileCount":4,"unpackedSize":6351,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbgsHvCRA9TVsSAnZWagAAs7MP/Rsu28Iq61a0i6oQhmkf\ncInK762vG3ZV28uiRd7d/zRp9XUjufm/uExybBiYr1Mby+u70A2l3YHV+cSV\nV86QVYzYUxVLpMrIkIxkp7DvBPJ6ub0XjOE2i+RrW2fEoc6/oKJ8S+z7wrqR\n8J+auWuED1K0UQkuwnaU3wFdIxZmenW/jOVQbHzRDQavycMvUuBfEP1ajqnw\nQaC+5+ZPbZRIfByhBRJO9+rl+mcC52YheHdbby3K+vgDrTLI/fsrlEMD7j0P\nYJ1fKVSOKNW3SdE3e5Tk2fMPc7LKQPekbQ8/MJVHrIHbRbbSQgQZ462S2aMZ\nnRZbs71DWK+mpeHhjh/GuUuJP5IWzF51+atbz6nwV3vEmK08DVc/rLFp05D6\nXRAJVQ3SuJ1/NnIHItW/nSde9ztd1weoJnPdZAHAk+HEtx/a+UfzbWvk8qml\nWme5gcJJPsMRqX6i9nIZ+JRoYUc7bhsnsZj/9igazznbrJxh2yI8bFXHL8Tn\nyBsYtyesp4iei1TQBxvmlC9TCFCMQw5nuH/j8ubMscRpgwArb50I6mDi3Acy\nwYDbbU8Nc73yxhkjyrhTWdyyUDCuf4RsvGoZ4r5/4/WYeeT8t6l/0KItKri3\nwh6UXPQY+jFmwLOFNap3vAR0aepd+VfX7eo7ev03unjYeVo9UQzmOq1Vc+ir\nyG6X\r\n=w+O0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDk0W6pcu+jKdIStqeGVb9wiuCIqN9q2+8xSDle6t7OyQIgCKEK6+m8/BZ+5c9JQC80QZs/HUMGsLUL4wxDuOT5uz8="}]},"maintainers":[{"name":"omrilotan","email":"omri@hamadgera.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/await-reduce_1.2.0_1535295983382_0.8528517625222729"},"_hasShrinkwrap":false},"1.2.1":{"name":"await-reduce","version":"1.2.1","description":"Resolve and reduce an array of promises","author":{"name":"omrilotan"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/omrilotan/mono.git"},"homepage":"https://omrilotan.com/mono/await-reduce/","main":"index.js","browser":"dist/index.js","scripts":{"dist":"mkdir -p dist; babel index.js --out-file dist/index.js","test":"cd ../../; npm t await-reduce; cd -"},"publishConfig":{"tag":"latest"},"bugs":{"url":"https://github.com/omrilotan/mono/issues"},"_id":"await-reduce@1.2.1","_npmVersion":"6.4.1","_nodeVersion":"10.2.1","_npmUser":{"name":"omrilotan","email":"omri@hamadgera.com"},"dist":{"integrity":"sha512-vqHNKjAUUtGSZBehDtqriaGL5FuZ14qvWqWP2kOO54QQdvHVIva7VG5FRGKUV1FVakKvQusjuv7SKmyJDuXYJw==","shasum":"c989af0522051af190a5e04021969985f08a026f","tarball":"https://registry.npmjs.org/await-reduce/-/await-reduce-1.2.1.tgz","fileCount":4,"unpackedSize":6631,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmVrYCRA9TVsSAnZWagAAgXEP/AqsABD1rWt3aEO4l46U\nHRM/Sv5ArQ1YFSPFxQRO4oQ5PZNpVj1X2mv3jlT0w9rL4uJPsMwc9BPprwDS\nFt9+Wk94HEqbQA1dxMk6knkIM9As6onDT/E2/1uhxwLMXmdxWP747IIkBqwR\nAR05scFMgNuLngSH2EP1iiYuJjh75dtm4kcLzZKAD0od3k78Q+dp7VbuYwfU\nnx7o1+7NFHCE2uxlrbsl7YyuaAj1YH0G7VNvRrkQKwmzlvwEGXf0F78AGmaH\nYgDyIn4KS4Bz613QU4hh1Ecj/NhaGW7tSBGke6wB2NTSZK5P1c3Qbwt2xG3C\n6YOvoOz4p+J532cWfD5O8jIjb7lr+GutkICv04C7qkriy/eVGmUdYavjmdEr\nWdRAZvimOFIW5569pYK48J3sMYYSpbAq66lApeF/CEaKTH5ESv+sYRwX9Kg8\nZPptl4HlKSF5LY7jfkWN1tGwTgxYnsH+1UYTMqSj4KPsSZu4if6P/N6NAnXs\n9+GiVZqLbzQD8xsmuuKopW2d7XExnSBPX322CmoBg80lxDwDljGUvRc1gIhO\nYCE0//xQi9UIYtPU2xc1uJBW1XjNkB3fZ22kdUK8PZSC5tBRbdO7yVLJ7wLr\nycFBbFEGJEKzOi1PpHf0vJYme6qBZaWlmSXjwAIZt+92y3QbgoxTW8yqjr1y\ngwX5\r\n=i9us\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD5An/AdiQhS+GpzqxacKIB2A3JzOOVAAKPHBpsKfg1ZgIgcBWtVlP+86t9AZeFBetafJv74A9P4lh8EppUfjvKky4="}]},"maintainers":[{"name":"omrilotan","email":"omri@hamadgera.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/await-reduce_1.2.1_1536776919936_0.5168255037897722"},"_hasShrinkwrap":false},"1.2.2":{"name":"await-reduce","version":"1.2.2","description":"Resolve and reduce an array of promises","author":{"name":"omrilotan"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/omrilotan/mono.git"},"homepage":"https://omrilotan.com/mono/await-reduce/","main":"index.js","browser":"dist/index.js","scripts":{"dist":"mkdir -p dist; babel index.js --out-file dist/index.js --config-file ../../.babelrc.js","test":"cd ../../; npm t await-reduce; cd -"},"publishConfig":{"tag":"latest"},"bugs":{"url":"https://github.com/omrilotan/mono/issues"},"_id":"await-reduce@1.2.2","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"omrilotan","email":"omri@hamadgera.com"},"dist":{"integrity":"sha512-EwF7YEkRibzU2I1MuP9UFjIQek737aURxeera/yrUsVPBLCqT74plGayAA3CrMeGzOh+KFbB92hr0lGgdOCVuw==","shasum":"fd27876f9b8e824d6163130119b868f064526490","tarball":"https://registry.npmjs.org/await-reduce/-/await-reduce-1.2.2.tgz","fileCount":4,"unpackedSize":6912,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb2u+CCRA9TVsSAnZWagAArKsP/2IDF2xKROTgYJckfaoQ\n5I1QGLPPPyCF4CBTYGgEfR/2aIJfLbdXR/j7T33I7jv8YW2v/8vQjCzc5RTr\nmvp9PfzCO7F3evZlsDNbXj1qd5AJd7Bzq/zi3j7WymaOGZuqg6xtMmFnb0Re\nZytUiY3NlnProaghxRvX7Oou4Y+hYeoOxapu/ELYSlt0pXInxBiBraS0vjHl\n6DJpH88v2fmOflKI4YcTaxK0RWsTMsa5PYL4/6lL/UBkZKDz3crB9UZ1ZZy1\nHcrb+SqGLDfksfUaKAICUqwjVrI9kOodkWGJB6n5bOw3LZGVqeTaQCBswfvB\nrDA2gObvG6gmBWMLegxph+HVc+cISXFCss/SVfZ7O6+WJPtSgqXSLr/S6ipU\nHNAiSDJ+N84oUklrAbYCotOLH5KWbXzBLqRaeFgfdwE7EpDp7dDLbOXRuxUe\nMihbHejPxNOS2SqzThPMw+fSTDgpGwkkm5snorAdHmrrFORdlotOnfq2ZgSt\nKz76ydeh1JMQbiVm4ewl+dywIl2qeZyC06/f7wS31GAFEtI6y0Qhchr1P97S\nrlboA6NDU/b6d1YKx+t21+VfOTvv04P/YxbuhAGGxyaDl8qvdxdUu4FJwGzl\nwOPAkot5RjIOqiH74NKZpUc/j7Ri1tRMaC6tvaRhgGNt0GzqRxiS6LXZ69au\n3ApS\r\n=Yz6A\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAKgh8swXIqyDIzoP/Zn6u9cMjJm7wwfGe6yCnH4XwJOAiEA57KRXM5VCNH0O43yr0PRFpdlT/k4FAt34TpOPE712rc="}]},"maintainers":[{"name":"omrilotan","email":"omri@hamadgera.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/await-reduce_1.2.2_1541074818023_0.03841268498324557"},"_hasShrinkwrap":false},"1.2.3":{"name":"await-reduce","version":"1.2.3","description":"Resolve and reduce an array of promises","keywords":["reduce","async","await","promise","iterable","iterator","accumulate"],"author":{"name":"omrilotan"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/omrilotan/mono.git"},"homepage":"https://omrilotan.com/mono/await-reduce/","main":"index.js","browser":"dist/index.js","scripts":{"dist":"mkdir -p dist; babel index.js --out-file dist/index.js --config-file ../../.babelrc.js","test":"cd ../../; npm t await-reduce; cd -"},"publishConfig":{"tag":"latest"},"bugs":{"url":"https://github.com/omrilotan/mono/issues"},"_id":"await-reduce@1.2.3","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"omrilotan","email":"omri@hamadgera.com"},"dist":{"integrity":"sha512-8ab9gpaciXsM0ut4kBpEmqWdsahtousNO4ZJ4dujXkLMS/b/iD9z+GAnLgqRAfjLBY4IzLC8pJ6IQFFTGtX3EA==","shasum":"f576fa8ff90bb586cc8164ed03abb23b5feee3eb","tarball":"https://registry.npmjs.org/await-reduce/-/await-reduce-1.2.3.tgz","fileCount":4,"unpackedSize":7037,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb4DaNCRA9TVsSAnZWagAA6fUP/j3XgRllh+p+lNMQkpFp\n2dLO3c8bQZOU1DmfVcXEZHhPKivOJWOdGifdQiEAc0tQYoxks3cxqxhD4e19\n1Pzk6ENcnadS2zwL4REHV+8rw7au9kKBh4h8mEmfgQox+4F/3c2a+GOX218k\nWKyuhXGpYWZRBi+MaN1xHA+3I4P7D8tuXhtvyckCU87dFJLBCD6LWbDLhNL0\n76Hj4rqliFdC41xv2IQbcrFFZbpwpeHiACi9lF+8G/rxqVqM2U9X8QwBGGQH\n/ZY8J+iEqjx92S4B4kspAQsHOX3c56uYoq0fEeBwZnzTIYs63DNYuVCQTbRK\nSJDQEclidDEhOejTCDtXr1pAb1Ev2nHdJJADq3AxEAMOuhn9y50ubTjaS3ll\nZI6omPK4+dtcrrg7luqSu7pIzErZ+zixdHJ59cdzMlWwI4QBk6Tzuxxqbf0+\nVi/E2AkEap+cav3Dgsd95q24oUaEzErmkZN92ug4EhzAAeb6eMHani/8cjXx\ngsEMB9Jx3kvXTX64a93qv6wh1Xt1RxPgepRdP99voTn3kqR99KJIBkYP1r2g\n2og6lSnbxvuRyomdGgX/8VY2ID6v1b+XKQSLHRXvgUNthvb+Mygj8bUuiNFL\nUAWM9oTnIvM/OA1iXwfNSiU5YHcanwIhDU92VWWP0E2EgHBYznRUCw5YDmvy\n3Qwc\r\n=ZiIw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+CETDE7I9ri3g21MlOvb3286/EK2l1D5YgB3D5uvn2wIgFHbn+zfKIHK1U6LPjuezJgZc5vHlWpHDmNYelq9eXd4="}]},"maintainers":[{"name":"omrilotan","email":"omri@hamadgera.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/await-reduce_1.2.3_1541420684555_0.6537008681645227"},"_hasShrinkwrap":false}},"time":{"created":"2018-06-04T13:45:57.056Z","1.0.0":"2018-06-04T13:45:57.145Z","modified":"2022-04-11T16:13:58.682Z","1.1.0":"2018-06-04T14:18:35.801Z","1.1.1":"2018-06-04T17:45:40.431Z","1.2.0":"2018-08-26T15:06:23.466Z","1.2.1":"2018-09-12T18:28:40.168Z","1.2.2":"2018-11-01T12:20:18.189Z","1.2.3":"2018-11-05T12:24:44.714Z"},"maintainers":[{"name":"omrilotan","email":"omri@hamadgera.com"}],"description":"Resolve and reduce an array of promises","homepage":"https://omrilotan.com/mono/await-reduce/","repository":{"type":"git","url":"git+https://github.com/omrilotan/mono.git"},"author":{"name":"omrilotan"},"bugs":{"url":"https://github.com/omrilotan/mono/issues"},"license":"MIT","readme":"# await-reduce [![](https://img.shields.io/npm/v/await-reduce.svg)](https://www.npmjs.com/package/await-reduce) [![](https://img.shields.io/badge/source--000000.svg?logo=github&style=social)](https://github.com/omrilotan/mono/tree/master/packages/await-reduce)\n\nResolve and reduce an array of promises\n\n```js\nconst reduce = require('await-reduce');\n```\n\nThe behaviour matches Array.prototype.reduce.\n\n```js\nconst results = await reduce(\n\t[\n\t\tfetch('one').then(res => res.json()),\n\t\tfetch('two').then(res => res.json()),\n\t\tfetch('ten').then(res => res.json()),\n\t],\n\t(accumulator, item) => [...accumulator, item],\n\t[]\n)\n```\n\nThe callback matches Array.prototype.reduce's 4 argument signature, except the 4th argument (`array`) are the results of the Promises, and the callback itself can be asynchronous as well.\n```js\nconst results = await reduce(\n\t[\n\t\tfetch('one'),\n\t\tfetch('two'),\n\t\tfetch('ten'),\n\t],\n\tasync (accumulator, response, index, array) => {\n\t\tif (!response.ok) {\n\t\t\treturn accumulator\n\t\t}\n\t\tconst data = await response.json()\n\t\treturn Object.assign(accumulator, data)\n\t},\n\t{}\n)\n```\n\n## Transpiled version\nEnvironments which exclude node_modules from the transpiling pipeline should include the \"browser\" entry instead of \"main\". This exposes an ES5 commonjs module.\n\nAlso available for explicit import:\n```js\nconst reduce = require('await-reduce/dist');\n```\n","readmeFilename":"README.md","keywords":["reduce","async","await","promise","iterable","iterator","accumulate"]}