{"name":"p-each-series","version":"3.0.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"},"type":"module","exports":"./index.js","engines":{"node":">=12"},"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":"^3.15.0","delay":"^5.0.0","time-span":"^4.0.0","tsd":"^0.14.0","xo":"^0.38.2"},"gitHead":"b212721691ac48e8081376a8f4f2ca77588acd01","bugs":{"url":"https://github.com/sindresorhus/p-each-series/issues"},"homepage":"https://github.com/sindresorhus/p-each-series#readme","_id":"p-each-series@3.0.0","_nodeVersion":"15.12.0","_npmVersion":"6.14.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-lastgtAdoH9YaLyDa5i5z64q+kzOcQHsQ5SsZJD3q0VEyI8mq872S3geuNbRUQLVAE9siMfgKrpj7MloKFHruw==","shasum":"d1aed5e96ef29864c897367a7d2a628fdc960806","tarball":"http://registry-npm.ywwl.com/p-each-series/download/p-each-series-3.0.0.tgz","fileCount":5,"unpackedSize":5943,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgb+fQCRA9TVsSAnZWagAA0NkP/ikOqmilmiQTc6A1YPJy\ngtbuGx6kfdehUzLoupTRrkJSgQWV67HpOVfCRRDzpSXq6Xq4fR034N53pkEd\nVWW7HQUc28/qr4A90CQfxjHQVggdtnLvMP25nj8tOsyC7H7OdfOzRgW7/2a3\ngDzlocjlBKGykko7KnnGl8FyIAnSCIp9/HvMJtjLaTbdmcOUIb20UKlqob1A\nSTqH7S8MtUkzEDEkpLr+uCAH/DW6EZiSPEXFokQyJhn+4IuiT+zfT+h74y1N\nD9KdaTe+JQye2YBJAJaau6Qha0zDPVKWvatLIzu/pEsPNGraC702wm6UL4gd\nHjA1a5wLjCqADI8/IVh5N3kuhwJFDFZl1yidXIs0l7MTQDp47SjyLuMedrJa\n22uHma8qUQzuFut7GAccD9e+rDQ/Fwj02L96zzQH+VZnYlM5xfxv3DH9TTSH\nJ3PnbPlmxzC+KuoMZ39salc44OhgwlXeeh9osX1HYggysuOd6kgaihTmN0yL\nQsZ4eOaNZjluiXFdgiXFJzynby2s+rYrHmDSAQQZesHCF85sv3eQZwh6Z8to\n3Xjxh+ORWD0+AxTI2rZN9UL1ktPf8T8dSbQFq+71hWt0jpT5OV2QfFtIAnbw\nNfnoF99y7aeFYY5+ePBJGskMPMOHtVpTU1XJ+28gZjc0q+ZsuObticEdmUg5\nSbLc\r\n=RMC7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB4ncicK2zwJp8q6Yq/0HH91oKG2MrRBp7aOMiptLQqLAiAMc2fls/oxv29K0/XHeYETVt9rFH8QK34GDHDXW2jV1Q=="}],"size":2486,"noattachment":false,"key":"/p-each-series/-/p-each-series-3.0.0.tgz"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/p-each-series_3.0.0_1617946575887_0.44802851470563554"},"_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":1617946575993,"_cnpm_publish_time":1617946575993,"dist-tags":{"latest":"3.0.0"}}