{"_id":"hwp","_rev":"11-a261772ea572dd58f07d1ecf1414d539","name":"hwp","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"hwp","version":"0.1.0","keywords":["async","iterator","highwatermark","high","watermark","processing"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","_id":"hwp@0.1.0","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/mcollina/hwp#readme","bugs":{"url":"https://github.com/mcollina/hwp/issues"},"dist":{"shasum":"9b1b2695d27594e35bd9e1a8dc72e7b129080b77","tarball":"https://registry.npmjs.org/hwp/-/hwp-0.1.0.tgz","fileCount":8,"integrity":"sha512-pB5OlWXE5Lq+T0VWFOdjAevqQIUW2nKJb47pHqZmA5hFGQd1DZfYWhDCDv/8pIjJ2+wMGkbokqgLjw+QPjKbow==","signatures":[{"sig":"MEUCIQDOPTzq1XakYDmC2Om9RuX5vzwSXIe2shAKnzjLArih1AIgYJrqnIpWfIbOaSWIKySZB5h4BSuI0MVHfLcSmEmXdJA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhE8o2CRA9TVsSAnZWagAAB6gP/iYo1Is1yTMNL2LDX8Ok\np658X9KL3A1Q/R6SYyw9NYXJAlgDVdGYjQL8tdPqYpxi/XPkECvlA24OviC5\nqyPKGVQc10ZfSNcYXd6k5oM8WI0REJsqG6stLI0oSl0gESWoAsr70Z3R8vdG\n0qLw5R9KxTbEg53JTXBnD8ZkO/+DqBrjfNA/VkyzIHBQ2N3xjGgi99S06AAA\nU5n22uJ6M6zrwk+6FZAFUIvk8uIKvm9l5RVzDQFFWPwVAkUupz/key98I+o1\nFp0vsbHiOJ+ShkSN6tS+VguZYx8ID6ErjuyAw0iUAgZ298f6t+wCMcWyOxx/\nEM5vtIhJeBToesVB52mwpuDH63iWNsOprXM2jcp0dkSb70oO0EmXncMK5KHe\nDLAugSJnRolOCVQzrVem/2BBspivA0iaY77U7t4Hk8Fiv6qez7XmCCnnpYiv\nVv7s5LM4hv6skzLJYVAFgVqwyX8i+tvR12d3xtMJlvrT5HxgYwgZ+DzvzfuA\n4MAHImSFP8y67aC2PE+utw8LBxwD1U9ObA1+c9rtuzMoPwm3g8fK2UOgyFaK\nZTQvtUwLi7i4SzjVm17r45MAI2R5RT2pwHZeUVSdbEG/TJyUKtCqqOYyI0XF\n4JHHa/lgWEewBUQcEG8Doro6QEYtZkVdqwK6ki1bjWN/s9S5T7REVEfBh1j+\nDuNJ\r\n=7FNm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"dc0d429b17673532a892bac2b5ee4dfd59a4decc","scripts":{"test":"standard && tap test/*.js"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"precommit":"test","repository":{"url":"git+https://github.com/mcollina/hwp.git","type":"git"},"_npmVersion":"6.14.13","description":"HighWatermark Processing with Async Iterators","directories":{},"_nodeVersion":"14.17.0","dependencies":{"p-limit":"^3.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^15.0.9","standard":"^16.0.3","@fastify/pre-commit":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/hwp_0.1.0_1628686902250_0.566200831249339","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"hwp","version":"0.1.1","keywords":["async","iterator","highwatermark","high","watermark","processing"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","_id":"hwp@0.1.1","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/mcollina/hwp#readme","bugs":{"url":"https://github.com/mcollina/hwp/issues"},"dist":{"shasum":"26c3e87d30345f29de1157133ee2c21931783a15","tarball":"https://registry.npmjs.org/hwp/-/hwp-0.1.1.tgz","fileCount":8,"integrity":"sha512-PJW9hyZmERIzUliT69K1Q67VVKwf6O1M5uM4MgaOMXABgvxfxF7jkFXO+WsI5r8UIeaKbjyDq/cBElXKUAOkBw==","signatures":[{"sig":"MEYCIQCcrLZCv9WXQP9jzs+xyNfv7lFWFiP8F17lRz+HRkeb0wIhAID5WrRUVagh9Xyvtqo6nB1kvvrQYgEWpntU0EPFP5uK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11723,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhI2BICRA9TVsSAnZWagAAsfYP/3jCqQtikTQUFfafHMto\n7BbL/ANVGNrpCOS8vVr/XHBSF8iqWXw7eoDJuxdYQNklFY7DsqNYwNFLyV8s\noZdgnMZoCjy8QT3pgkfwXA3P4mHgHQ0JeVNDTxTOGzrlepQtIgHS0M2H26om\nLEH8L8pFVz4pBjkTWyjcvEFq4EYDg7SSspZWIEnY/jVnCaRq9sIFs5J4EXnZ\nBt+qjE6Gae/AFPW8KGlWm0D3VoCifF9x4X032RYv+B9bI5g1G5p+m+vA4lF7\nuvsV94LZTmUUxwbZ8wZIKfa8nh67QmN+cQnj4lTt12H/O/F1Y7bV7eewJKqX\ne6cPBwfLe0m7QrU5gFdvtGQGtC25LT0EKOJkGrxvcdwb+t9XOP/BT83Pdl1m\nYBgRuHU7CI+MXtQDylMVHr46qrXyUMX1dk+zB5lDQQzcCGaVPEEr/hLfsWwP\nDjXQqSUvHEtVRYc8dumQwpJ+IqzCNTOVygqMbv2Ls5anU3BRHS0u5AZl9XAk\ntnt1XyCtR+axH/eWV1WgKIJ+ISVBzUY8b2L1X7qdcEce/Pm0F2zuUDzx3QX2\nqiW6ykFcP5+AQaaosVnXwRbtFubWhGxyxfQpRf/Dm4mMUfFmu1Qn+zZ73eJV\nuv+RuBODI6jTiuduMLePIYMHDfxHNRIP4il368hLnGo4jFVpDYU3ycprAxWl\nD/Yi\r\n=mwT1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"c62ab5ab5424761c3acbfa0f7350df54c59aa251","scripts":{"test":"standard && tap test/*.js"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"precommit":"test","repository":{"url":"git+https://github.com/mcollina/hwp.git","type":"git"},"_npmVersion":"6.14.13","description":"HighWatermark Processing with Async Iterators","directories":{},"_nodeVersion":"14.17.0","dependencies":{"p-limit":"^3.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^15.0.9","standard":"^16.0.3","@fastify/pre-commit":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/hwp_0.1.1_1629708360165_0.07008829672183792","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"hwp","version":"0.2.0","keywords":["async","iterator","highwatermark","high","watermark","processing"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","_id":"hwp@0.2.0","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/mcollina/hwp#readme","bugs":{"url":"https://github.com/mcollina/hwp/issues"},"dist":{"shasum":"feb431ebe8339f1d710ad4a872928ad5edb64993","tarball":"https://registry.npmjs.org/hwp/-/hwp-0.2.0.tgz","fileCount":8,"integrity":"sha512-9S+mY/IiOvlFX/Tfz2TxLVnkMlnyw9DLJVZnhdb+on39E8UvXXDlY25HyrHu74d9zObnafdV16K89OZlHmn9vQ==","signatures":[{"sig":"MEUCIBKp8Gfv3E6HiOH0/OLEmG91aHKsqZLbqVkN5+PhOiZOAiEAl9v7jpZxm1BiTf+hAqS4BMHMJSg6Bgo7wh1ZUo6USwU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14647,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhI6AiCRA9TVsSAnZWagAAVXwP/i5+E9o3b1M4s76sAbPZ\nBnRrjlNaKvIomGruTLVjOP20XScuJwpuDIjnwTNwOukq/QRweas3ZccaAE5j\n6M2T5Eg7E9Dc9mSatY37sj6FjNl3PO6xrk6IyV2A4j74re7CSdw2cTzeenla\n/NPTccKXmJR8xl+ITSr3pG7hRJbu7A6LDWln7hhKhnmrPf0KzS5OlHVcjqIc\nmFJ1Gl1QAuETqBo/dutxExdVXM2449QKEvimSU64eo2kbniIrt/sRdsKFCng\nfXjNqwx5mXSLHQQ1MF+ci0Q8zfDOtrrDQm/HMDrEpppIjhXhwRWNj3NDrtyf\nLjf44d7m+ACKnn8N8gONmcp6LyQOtERXo50v3dqJbT8W3iuKGuGp2wjljp8Z\nt5JhCk7WB6wL5mXDkzs9n++i5kEyv+NLiXzJrpjNGH51kWh1oDDDnl9W9RS4\noek4XW9BpMTgorjK9P3T4iGfHVvxcqmk9fXjUSSmmFGP/h9qUm9FyAhmQ6t6\nUe4ZQ7ivsTuU3+VeoRcBqpHCGHVEnDOev8oWUlRv6v5U0DYYUsnflAE+8Tnx\nUZMm+77cOoOC2TP9ELdD88z3RHwL708a2FCogTwMWXKoPSP9DDAVKBw3RxeN\nMM1pUPgy9mCLVJcjuyOqoQhJ8v2aKpCilp547hVDh+o8MhfiD63PrMTA0np1\nwRgQ\r\n=R+rG\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"3b2b23b9ef9e08e3df0251532767fa426e214e8f","scripts":{"test":"standard && tap test/*.js"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"precommit":"test","repository":{"url":"git+https://github.com/mcollina/hwp.git","type":"git"},"_npmVersion":"7.20.3","description":"HighWatermark Processing with Async Iterators","directories":{},"_nodeVersion":"16.7.0","_hasShrinkwrap":false,"devDependencies":{"tap":"^15.0.9","standard":"^16.0.3","@fastify/pre-commit":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/hwp_0.2.0_1629724706245_0.2372020191677111","host":"s3://npm-registry-packages"}},"0.3.0":{"name":"hwp","version":"0.3.0","keywords":["async","iterator","highwatermark","high","watermark","processing"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","_id":"hwp@0.3.0","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/mcollina/hwp#readme","bugs":{"url":"https://github.com/mcollina/hwp/issues"},"dist":{"shasum":"66cd29f1f0a242dd6d747e99b351861f384b5cce","tarball":"https://registry.npmjs.org/hwp/-/hwp-0.3.0.tgz","fileCount":8,"integrity":"sha512-G10ai+d+6RPUqhsMCAVCY1NVUycun3cldQfu1qu1AaBUT+TPetKJ0jLBpxxkVE3sCOl1hfVtiYCSZGCl3RMzEw==","signatures":[{"sig":"MEUCIQDulMkEv7TgPAegKERIeCYd1UyLwS8PzWn5xxk+ft1o7AIgVGOZ9L7bVRV+J7E+EgpzIFxl1b24xavMPSMMARIMsAQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15473,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhI8q5CRA9TVsSAnZWagAAgH4P/jFGlxC2PdEFzIurApXj\no+o9DEtBYnv/+wYtV0+gergLNnlpI4joKccZcMF3sV60F0JehzusEK66QQ4/\nZ7gtUdeiRyvBhpcnc0KeKM7yR8fQ16g4p4EUWLD/6Szul+QcBK7fDjI92I1K\nEd04ZSejtlfwsPzltDNwWa6H6MAxmwGakC1VFgTwH5hN3Rh8nT76/fqstdMx\nQYv8/KkPX0CrBljKSe/W80pLyDf72l0NvsOLYoUZIEb2g7b5ogQeNrzUEZiy\nkv88fnCxuvAs5QxS6PbDgm5nfgKHXLqbh5Zs7aNPDKMncLmoUDjnskaRNhgo\nuBZ7N7i5nnaSGcT2duYsrK3UU51TV89BpiiB9jbnZMQq/PfKMk/cYmY0k6U7\nkBOBoGFbzsvszDK9Y1g8HKYYAG7YCPmHXThA7mNVSK/1rCFgp/7dDtuK21g6\n67UztIQie7XLvsNeDKgmyAjXd2QjRq2cdkKUP2teNGK/MXWH7dr8/47BxZMG\nDG9uKfSIsYXL7mmM/8J233kTpx1pVQP4tL+JRV86bivmmCOUPIJHH+41Yx3g\nftx7WxAn54AgzmWP+Z1CMJNjPVM3QOYhnYw++eXH+uIhAPUugBfqHqNklaxA\nO49YdNCeKfZNpaWjFnW00c6/SrZML1JNc+Ler56YLwOpGUvjKpsvuP0EAQvu\ndIRl\r\n=f04y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"3d84cc34e47c5f052711ba86a341f785bdc11c2b","scripts":{"test":"standard && tap test/*.js"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"precommit":"test","repository":{"url":"git+https://github.com/mcollina/hwp.git","type":"git"},"_npmVersion":"7.20.3","description":"HighWatermark Processing with Async Iterators","directories":{},"_nodeVersion":"16.7.0","dependencies":{"abort-controller":"^3.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^15.0.9","standard":"^16.0.3","@fastify/pre-commit":"^2.0.2"},"_npmOperationalInternal":{"tmp":"tmp/hwp_0.3.0_1629735609369_0.007923468738217698","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"hwp","version":"0.4.0","keywords":["async","iterator","highwatermark","high","watermark","processing"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","_id":"hwp@0.4.0","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/mcollina/hwp#readme","bugs":{"url":"https://github.com/mcollina/hwp/issues"},"dist":{"shasum":"9bc747a3bc64f427152c9fa720a0db37f6fc60e8","tarball":"https://registry.npmjs.org/hwp/-/hwp-0.4.0.tgz","fileCount":10,"integrity":"sha512-x0ogHULR/mtbf2PuMpCwm67uTDP7gw6f+sGPb6OY/39h+9VAZt+7uJFApirHGHMf+PlNwC9T+pcNFdwsu30ohg==","signatures":[{"sig":"MEUCICRdQ69F4GqIDgEAcDdahSCpohw5FOv/D5mIW8ZRLVq6AiEAuy5EpbsdTYWnokn+PMbScrrLQGdSUYGb7AHGXGeg96s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17569},"main":"index.js","gitHead":"32a932eef2651a7a5725ef37d6b19850d46a9b12","scripts":{"lint":"eslint . --fix","test":"eslint . && node --test"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"precommit":"test","repository":{"url":"git+https://github.com/mcollina/hwp.git","type":"git"},"_npmVersion":"10.8.2","description":"HighWatermark Processing with Async Iterators","directories":{},"_nodeVersion":"18.20.5","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.25.1","neostandard":"^0.12.1","@fastify/pre-commit":"^2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/hwp_0.4.0_1745312700679_0.4630200072489421","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"hwp","version":"0.4.1","keywords":["async","iterator","highwatermark","high","watermark","processing"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","_id":"hwp@0.4.1","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"homepage":"https://github.com/mcollina/hwp#readme","bugs":{"url":"https://github.com/mcollina/hwp/issues"},"dist":{"shasum":"4a38898f4ae82ff70aa8179235325139a707d83b","tarball":"https://registry.npmjs.org/hwp/-/hwp-0.4.1.tgz","fileCount":13,"integrity":"sha512-aN+FxnVyrNmIx6ULuAyefgQffE0NF9GRzW+lB5cAp5kxN5PBdjf8Ws+IvDHHJM1a7pyXTP9t0gwz7E/Z5ikj8w==","signatures":[{"sig":"MEUCIFz68vl5Jr4c18H+M4zG/GOc89E0NVOy6mrgOq0zSny1AiEAkoyjP8794GCNJeOeRsAZdhj3WhYB3DBH5NNrmEHW2F4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22551},"main":"index.js","types":"index.d.ts","gitHead":"42d027e366fd4569e1c4344d9e5ddb42ae5bdd3b","scripts":{"lint":"eslint . --fix","test":"eslint . && node --test && npm run test:types","test:types":"tstyche"},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"precommit":"test","repository":{"url":"git+https://github.com/mcollina/hwp.git","type":"git"},"_npmVersion":"11.3.0","description":"HighWatermark Processing with Async Iterators","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.25.1","tstyche":"^3.5.0","typescript":"^5.8.3","neostandard":"^0.12.1","@fastify/pre-commit":"^2.2.0"},"_npmOperationalInternal":{"tmp":"tmp/hwp_0.4.1_1745318352786_0.21700483028903017","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"hwp","version":"0.5.0","description":"HighWatermark Processing with Async Iterators","main":"index.js","types":"index.d.ts","scripts":{"lint":"eslint . --fix","test":"eslint . && node --test && npm run test:types","test:types":"tstyche"},"precommit":"test","repository":{"type":"git","url":"git+https://github.com/mcollina/hwp.git"},"keywords":["async","iterator","highwatermark","high","watermark","processing"],"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","bugs":{"url":"https://github.com/mcollina/hwp/issues"},"homepage":"https://github.com/mcollina/hwp#readme","devDependencies":{"@fastify/pre-commit":"^2.2.0","eslint":"^9.25.1","neostandard":"^0.12.1","tstyche":"^3.5.0","typescript":"^5.8.3"},"gitHead":"55c66ea3671b7144dff703203df6a475789f1d2c","_id":"hwp@0.5.0","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-IFWeFX72NsnHzCOTNdNLc+dN84d9oLMdLtqYsPLZeKwpO9S+1pztxJ7k88sqio/QZyRC5wrgY5xm16A0kscPHA==","shasum":"28686b0b8e6f2871159cd400e6ec77cf775671ba","tarball":"https://registry.npmjs.org/hwp/-/hwp-0.5.0.tgz","fileCount":14,"unpackedSize":34484,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGmlt6SK08uEFTgDcE1OfB/JYGerT4akGeoNajVmeVbrAiEAlS8++vZFQaqIu1F+HL7QflzCm9uXYtxkxPLR2RLYND8="}]},"_npmUser":{"name":"matteo.collina","email":"hello@matteocollina.com"},"directories":{},"maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/hwp_0.5.0_1789390795996_0.7505339810351801"},"_hasShrinkwrap":false}},"time":{"created":"2021-08-11T13:01:42.250Z","modified":"2026-09-14T12:59:56.305Z","1.0.0":"2018-09-16T12:40:07.452Z","0.1.0":"2021-08-11T13:01:42.356Z","0.1.1":"2021-08-23T08:46:00.335Z","0.2.0":"2021-08-23T13:18:26.360Z","0.3.0":"2021-08-23T16:20:09.486Z","0.4.0":"2025-04-22T09:05:00.845Z","0.4.1":"2025-04-22T10:39:12.962Z","0.5.0":"2026-09-14T12:59:56.151Z"},"bugs":{"url":"https://github.com/mcollina/hwp/issues"},"author":{"name":"Matteo Collina","email":"hello@matteocollina.com"},"license":"MIT","homepage":"https://github.com/mcollina/hwp#readme","keywords":["async","iterator","highwatermark","high","watermark","processing"],"repository":{"type":"git","url":"git+https://github.com/mcollina/hwp.git"},"description":"HighWatermark Processing with Async Iterators","maintainers":[{"name":"matteo.collina","email":"hello@matteocollina.com"}],"readme":"# hwp\n\nConsume Async Iterators with a highwatermark, i.e. in batches.\nThis allows for multiple processing happening in parallel instead of one at a time.\n\nThe default highwatermark is `16`.\n\nTypeScript type definitions are included.\n\n## Install\n\n```js\nnpm i hwp\n```\n\n## Usage\n\n```js\nimport { forEach, map, mapIterator, mapper, batchIterator, batch, batcher } from 'hwp'\nimport { pipeline } from 'stream/promises'\n\nconst expected = ['a', 'b', 'c']\n\nasync function * something () {\n  const toSend = [...expected]\n  yield * toSend\n}\n\nawait forEach(something(), async function (item, { signal }) {\n  return someAsyncFunction(item, { signal })\n}, 16)\n\nconst res = mapIterator(something(), async function (item, { signal }) {\n  return someAsyncFunction(item, { signal })\n}, 16)\n\nfor await (const item of res) {\n  console.log(item)\n}\n\nconsole.log(await map(something(), async function (item, { signal }) {\n  return someAsyncFunction(item, { signal })\n}), 16)\n\nawait pipeline(\n  something(),\n  mapper((item, { signal }) => {\n    return someAsyncFunction(item, { signal })\n  }, 16),\n  async function (source) {\n    for await (const item of source) {\n      console.log(item)\n    }\n  }\n)\n```\n\n## Batching\n\nThe batch operators accumulate items from an async iterator into arrays and\nrelease them as batches. A batch is released as soon as it reaches `max` items,\nor when the flush signal fires since the first item of the batch arrived\n(releasing an incomplete batch).\n\nThe flush signal is a `timeout` in milliseconds. When `timeout` is omitted the\nbatch is released on the next `setImmediate`, i.e. as soon as the current\nevent-loop turn completes.\n\n```js\nimport { batchIterator, batch, batcher } from 'hwp'\n\nasync function * something () {\n  const toSend = [1, 2, 3, 4, 5]\n  yield * toSend\n}\n\n// no timeout: flushes on the next setImmediate\nfor await (const batch of batchIterator(something(), 3)) {\n  console.log(batch)\n}\n\n// yields [1, 2, 3], [4, 5]\nfor await (const batch of batchIterator(something(), 3, 1000)) {\n  console.log(batch)\n}\n\n// collects all batches into an array of arrays\nconsole.log(await batch(something(), 3, 1000))\n\n// creates a reusable batcher\nconst batcher = batcher(3, 1000)\nfor await (const batch of batcher(something())) {\n  console.log(batch)\n}\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}