{"name":"p-each-series","version":"2.2.0","description":"Iterate over promises serially","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/p-each-series.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://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":"133ef8bd6121bd22f9867ef80438aab9fced6125","bugs":{"url":"https://github.com/sindresorhus/p-each-series/issues"},"homepage":"https://github.com/sindresorhus/p-each-series#readme","_id":"p-each-series@2.2.0","_nodeVersion":"15.1.0","_npmVersion":"6.14.8","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-ycIL2+1V32th+8scbpTvyHNaHe02z0sjgh91XXjAk+ZeXoPN4Z46DVUnzdso0aX4KckKw0FNNFHdjZ2UsZvxiA==","shasum":"105ab0357ce72b202a8a8b94933672657b5e2a9a","tarball":"http://registry-npm.ywwl.com/p-each-series/download/p-each-series-2.2.0.tgz","fileCount":5,"unpackedSize":6336,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJftaDnCRA9TVsSAnZWagAAc+UP/iQ4hKD0bo1080Ty2PWr\n0kogxxX/DoSjnVSNz4Wt0p4TsVFh3LBnRPb1bRQw/pylrvoSz0BuugYkqsSQ\nKClKSbBsm6BhPw1ovyLdnKO4NDHT2V4oz3B2tEUdPitY0mTLvvWoTm+me1RX\nHJncR0hFdnhX1IJ/87puMtNFLqj2aN8fQgjw4Q6VoRLWEjVLUG3dfrGHUp0B\n4f3bIlRtb3sxuX1LdscxZrhoB5wCnfQqNx/hPsZo/n5CZbzYtgqWeOKA3yA8\n96J2Cc9VfirES/77rEEgM5IrAHDAlQZIywMmcrpelHvs6hHKJushgM1eHrTp\nrU43rVNitao2aT44+9N+qXwdKH8xLu6XoeuaPEYdgjj7oZPUZW5dMC8DOkmE\negrJNO5KReq6PfDX/JCDJghmRlf4gmjvpgkN+mXBl4K5LXZBsCb4DbUgIZeu\n0jQS/voTA/U9Rh8659lbPu4P63sZypi3NINnb/Y5WiOVq1jtx03ReUMNDuW4\n05t8V47N9zp7rehwf80/MHTtN/SQiOTHEUQ1cqDzIFMeBnLIQR1VpKf7pBVR\nfyD0iZ6LDMTsNWfAb0gN4wVHUHKYLobzs9YuWIL/BJxX88/4jGzKMZZvKiEj\nWGF7iLYzddKKntPzUQLF3zgdo729y0aApHxjqGs+0NzjYYb1wp/Ll2bC4Vv2\nxa12\r\n=38JR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDK/es/gYTba0H6N9UdLXsuJ1m2AHNUZ02Nj3Dl1dpu9AiEA8oOLAZ8hrgL4HMAKbcRhwGjpFG6A+TlBCM5aBq017bo="}],"size":2643,"noattachment":false,"key":"/p-each-series/-/p-each-series-2.2.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-each-series_2.2.0_1605738727266_0.3086274688186348"},"_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":1605738727420,"_cnpm_publish_time":1605738727420,"dist-tags":{"latest":"3.0.0"}}