{"name":"p-each-series","version":"2.1.0","description":"Iterate over promises serially","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-each-series.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["promise","foreach","for-each","for","each","collection","iterable","iterator","fulfilled","async","await","promises","serial","serially","series","bluebird"],"devDependencies":{"ava":"^1.4.1","delay":"^4.1.0","time-span":"^3.0.0","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"ccffc6404419c4a6c08aff12e146a6fe9b7f9501","bugs":{"url":"https://github.com/sindresorhus/p-each-series/issues"},"homepage":"https://github.com/sindresorhus/p-each-series#readme","_id":"p-each-series@2.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ==","shasum":"961c8dd3f195ea96c747e636b262b800a6b1af48","tarball":"http://registry-npm.ywwl.com/p-each-series/download/p-each-series-2.1.0.tgz","fileCount":5,"unpackedSize":5532,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcpY3ECRA9TVsSAnZWagAApwoQAIcAP1yz9AWdeyzSE9D2\nzq8LiogrRF1OrFRqtkCtpvYmfFRcKKhJCfO11Nd9i+NjhchA2b6exyevHCwK\n788q46+Afg5J6E5FuaBvMlhsj0vj7SGcx8IjyvmdWX+0hIpBrq2v5wfXl0t8\nAIFUQVNhi5InK9qXQpfz0DsjtzhLe8knFe389yeZRwen/WOfjaA3ZAwuWON2\nfoSYkVGbuzVlYIp/WivNmbgGjeD0+m5eW/fjiybaffT1kmrjvqJde8s5oQz1\nSc3HQJVzbGYO30wLY0NeG3LaQGXjxYzLWMkcQi0GM0Qv+QH4FeuACZFSRLtJ\nNKMZohH9a+LpgHdG249xiepgJGs2+ys3tSI5JCq2cUMKoQcg4HcaVLKzi2BD\n1wEKIOShp/oE7bdqZSQfjtcHrhSG4/VaH/e3ID2TcIBITwUTh8t/vNox0SJ0\nDBjmJesuYEWybHHPs1PoGvZXhr7Mln/064I+vGdoaCovE9rKJ2EM3aPIU1ss\nx8T9GSgilr86EK+McRwkQThPBsZQtCNtR3V/ORrlSV/goNpWKf2H8yjxLaFF\nrNJEpR7cp09vVSmUV12s439bGQW+pesz9Yo762GIqk6LTg2gRLdSEWDoxWct\nazzJ+hni3L3FqPd1cttbAtoWokX0AD8a9sJEK2/JqC4T4YxyptJqFLBoZUuW\nGzJP\r\n=TSqc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDrw8IYYvb+GySWUjqOKS0HcsCIkObKLuh+1CCvLFisvwIhAMjN78avZQa6rk39t4ugwRJK1fqQTIW8fVeXOqj7xFao"}],"size":2397,"noattachment":false,"key":"/p-each-series/-/p-each-series-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-each-series_2.1.0_1554353604096_0.0836061994519759"},"_hasShrinkwrap":false,"readme":"# p-each-series\n\n> Iterate over promises serially\n\nUseful as a side-effect iterator. Prefer [`p-map`](https://github.com/sindresorhus/p-map) if you don't need side-effects, as it's concurrent.\n\n## Install\n\n```\n$ npm install p-each-series\n```\n\n## Usage\n\n```js\nimport pEachSeries from 'p-each-series';\n\nconst keywords = [\n\tgetTopKeyword(), //=> Promise\n\t'rainbow',\n\t'pony'\n];\n\nconst iterator = async element => saveToDiskPromise(element);\n\nconsole.log(await pEachSeries(keywords, iterator));\n//=> ['unicorn', 'rainbow', 'pony']\n```\n\n## API\n\n### pEachSeries(input, iterator)\n\nReturns a `Promise` that is fulfilled when all promises in `input` and ones returned from `iterator` are fulfilled, or rejects if any of the promises reject. The fulfillment value is the original `input`.\n\n#### input\n\nType: `Iterable<Promise | unknown>`\n\nIterated over serially in the `iterator` function.\n\n#### iterator(element, index)\n\nType: `Function`\n\nReturn value is ignored unless it's `Promise`, then it's awaited before continuing with the next iteration.\n\n### pEachSeries.stop\n\nStop iterating through items by returning `pEachSeries.stop` from the iterator function.\n\n```js\nimport pEachSeries from 'p-each-series';\n\n// Logs `a` and `b`.\nconst result = await pEachSeries(['a', 'b', 'c'], value => {\n\tconsole.log(value);\n\n\tif (value === 'b') {\n\t\treturn pEachSeries.stop;\n\t}\n});\n\nconsole.log(result);\n//=> ['a', 'b', 'c']\n```\n\n## Related\n\n- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially\n- [p-series](https://github.com/sindresorhus/p-series) - Run promise-returning & async functions in series\n- [p-pipe](https://github.com/sindresorhus/p-pipe) - Compose promise-returning & async functions into a reusable pipeline\n- [p-waterfall](https://github.com/sindresorhus/p-waterfall) - Run promise-returning & async functions in series, each passing its result to the next\n- [p-reduce](https://github.com/sindresorhus/p-reduce) - Reduce a list of values using promises into a promise for a value\n- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently\n- [More…](https://github.com/sindresorhus/promise-fun)\n","publish_time":1554353604236,"_cnpm_publish_time":1554353604236,"dist-tags":{"latest":"3.0.0"}}