{"_id":"@cjser/p-each-series","name":"@cjser/p-each-series","dist-tags":{"latest":"3.0.0-cjser.2"},"versions":{"3.0.0-cjser.2":{"name":"@cjser/p-each-series","version":"3.0.0-cjser.2","description":"Iterate over promises serially","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"require":"./dist-cjser/index.cjs","default":"./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"},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"3.0.0","cjserVersion":2,"original":{"name":"p-each-series","version":"3.0.0","exports":"./index.js","repository":"sindresorhus/p-each-series","files":["index.js","index.d.ts"],"scripts":{"test":"xo && ava && tsd"}}},"_id":"@cjser/p-each-series@3.0.0-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-n1v/lPdn8HC9+HRmB0EGcoHEmt2D3lrGI7weIg+CCRF3Tp5QfLabkp5YiLtS/Er+BlmEcbeMKmFuYqLSDwLEKQ==","shasum":"bd7b0255d146baafc256a4f6c6e02c59f3fa9708","tarball":"https://registry.npmjs.org/@cjser/p-each-series/-/p-each-series-3.0.0-cjser.2.tgz","fileCount":6,"unpackedSize":8214,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDNE+g+RPTEXfgZZ9FI5rzvq+xgn3FxjLOs/9u++Y2rBQIgQO2FrvdQ6FRgHlrDkCjLMVKj/X7lC1g3IzuWlUuc83I="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/p-each-series_3.0.0-cjser.2_1778159327178_0.2051552005038113"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T13:08:47.112Z","3.0.0-cjser.2":"2026-05-07T13:08:47.335Z","modified":"2026-05-07T13:08:47.609Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Iterate over promises serially","keywords":["promise","foreach","for-each","for","each","collection","iterable","iterator","fulfilled","async","await","promises","serial","serially","series","bluebird"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","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\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/p-each-series\n","readmeFilename":"readme.md","_rev":"1-5d7f1869bb1e85865f326a0b6f965b7d"}