iter-fest 0.1.1-main.cd8f1a7 → 0.1.1-main.d88474c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (468) hide show
  1. package/README.md +56 -117
  2. package/dist/{chunk-H27CTQGV.mjs → chunk-27NJVC7K.mjs} +5 -8
  3. package/dist/chunk-27NJVC7K.mjs.map +1 -0
  4. package/dist/chunk-44W7OTNE.mjs +12 -0
  5. package/dist/chunk-44W7OTNE.mjs.map +1 -0
  6. package/dist/chunk-5CHMNKXJ.mjs +20 -0
  7. package/dist/chunk-5CHMNKXJ.mjs.map +1 -0
  8. package/dist/chunk-5CRMPYKD.mjs +19 -0
  9. package/dist/chunk-5CRMPYKD.mjs.map +1 -0
  10. package/dist/chunk-6C3P4TNK.mjs +19 -0
  11. package/dist/chunk-6C3P4TNK.mjs.map +1 -0
  12. package/dist/{chunk-RVIERPEV.mjs → chunk-EUVK4YM7.mjs} +5 -6
  13. package/dist/chunk-EUVK4YM7.mjs.map +1 -0
  14. package/dist/chunk-EZC33HE6.mjs +15 -0
  15. package/dist/chunk-EZC33HE6.mjs.map +1 -0
  16. package/dist/chunk-GWZF5BB7.mjs +16 -0
  17. package/dist/chunk-GWZF5BB7.mjs.map +1 -0
  18. package/dist/chunk-HYU4EN7J.mjs +20 -0
  19. package/dist/chunk-HYU4EN7J.mjs.map +1 -0
  20. package/dist/chunk-JU353VSE.mjs +16 -0
  21. package/dist/chunk-JU353VSE.mjs.map +1 -0
  22. package/dist/{chunk-EQZQP6GW.mjs → chunk-KONB7TV6.mjs} +5 -8
  23. package/dist/chunk-KONB7TV6.mjs.map +1 -0
  24. package/dist/{chunk-H5ARVU55.mjs → chunk-MDBK7ND5.mjs} +5 -8
  25. package/dist/chunk-MDBK7ND5.mjs.map +1 -0
  26. package/dist/chunk-MNLOWKTC.mjs +19 -0
  27. package/dist/chunk-MNLOWKTC.mjs.map +1 -0
  28. package/dist/{chunk-YJSIVBF7.mjs → chunk-MOBXUTO5.mjs} +5 -5
  29. package/dist/chunk-MOBXUTO5.mjs.map +1 -0
  30. package/dist/chunk-O5SQJUKB.mjs +37 -0
  31. package/dist/chunk-O5SQJUKB.mjs.map +1 -0
  32. package/dist/chunk-TEI3K6GT.mjs +21 -0
  33. package/dist/chunk-TEI3K6GT.mjs.map +1 -0
  34. package/dist/{chunk-AN54W42O.mjs → chunk-UIEKIMLW.mjs} +5 -8
  35. package/dist/chunk-UIEKIMLW.mjs.map +1 -0
  36. package/dist/chunk-V6OWQQ3Q.mjs +20 -0
  37. package/dist/chunk-V6OWQQ3Q.mjs.map +1 -0
  38. package/dist/{chunk-IZXDQ25M.mjs → chunk-WKIRSZXX.mjs} +5 -8
  39. package/dist/chunk-WKIRSZXX.mjs.map +1 -0
  40. package/dist/chunk-XKBVB2JN.mjs +12 -0
  41. package/dist/chunk-XKBVB2JN.mjs.map +1 -0
  42. package/dist/chunk-XW34KZRY.mjs +17 -0
  43. package/dist/chunk-XW34KZRY.mjs.map +1 -0
  44. package/dist/chunk-Y5M2C7NQ.mjs +13 -0
  45. package/dist/chunk-Y5M2C7NQ.mjs.map +1 -0
  46. package/dist/chunk-ZUBHGSCW.mjs +18 -0
  47. package/dist/chunk-ZUBHGSCW.mjs.map +1 -0
  48. package/dist/iter-fest.d.mts +23 -42
  49. package/dist/iter-fest.d.ts +23 -42
  50. package/dist/{iter-fest.iteratorAt.d.mts → iter-fest.iterableAt.d.mts} +2 -2
  51. package/dist/{iter-fest.iteratorAt.d.ts → iter-fest.iterableAt.d.ts} +2 -2
  52. package/dist/{iter-fest.iteratorAt.js → iter-fest.iterableAt.js} +10 -21
  53. package/dist/iter-fest.iterableAt.js.map +1 -0
  54. package/dist/iter-fest.iterableAt.mjs +8 -0
  55. package/dist/iter-fest.iterableConcat.d.mts +16 -0
  56. package/dist/iter-fest.iterableConcat.d.ts +16 -0
  57. package/dist/iter-fest.iterableConcat.js +40 -0
  58. package/dist/iter-fest.iterableConcat.js.map +1 -0
  59. package/dist/iter-fest.iterableConcat.mjs +7 -0
  60. package/dist/iter-fest.iterableEntries.d.mts +6 -0
  61. package/dist/iter-fest.iterableEntries.d.ts +6 -0
  62. package/dist/{iter-fest.iteratorEntries.js → iter-fest.iterableEntries.js} +9 -22
  63. package/dist/iter-fest.iterableEntries.js.map +1 -0
  64. package/dist/iter-fest.iterableEntries.mjs +7 -0
  65. package/dist/iter-fest.iterableEvery.d.mts +24 -0
  66. package/dist/iter-fest.iterableEvery.d.ts +24 -0
  67. package/dist/iter-fest.iterableEvery.js +43 -0
  68. package/dist/iter-fest.iterableEvery.js.map +1 -0
  69. package/dist/iter-fest.iterableEvery.mjs +7 -0
  70. package/dist/iter-fest.iterableFilter.d.mts +16 -0
  71. package/dist/iter-fest.iterableFilter.d.ts +16 -0
  72. package/dist/iter-fest.iterableFilter.js +42 -0
  73. package/dist/iter-fest.iterableFilter.js.map +1 -0
  74. package/dist/iter-fest.iterableFilter.mjs +7 -0
  75. package/dist/iter-fest.iterableFind.d.mts +15 -0
  76. package/dist/iter-fest.iterableFind.d.ts +15 -0
  77. package/dist/iter-fest.iterableFind.js +43 -0
  78. package/dist/iter-fest.iterableFind.js.map +1 -0
  79. package/dist/iter-fest.iterableFind.mjs +7 -0
  80. package/dist/{iter-fest.iteratorFindIndex.d.mts → iter-fest.iterableFindIndex.d.mts} +4 -4
  81. package/dist/{iter-fest.iteratorFindIndex.d.ts → iter-fest.iterableFindIndex.d.ts} +4 -4
  82. package/dist/{iter-fest.iteratorFindIndex.js → iter-fest.iterableFindIndex.js} +10 -23
  83. package/dist/iter-fest.iterableFindIndex.js.map +1 -0
  84. package/dist/iter-fest.iterableFindIndex.mjs +7 -0
  85. package/dist/{iter-fest.iteratorFindLast.d.mts → iter-fest.iterableFindLast.d.mts} +5 -5
  86. package/dist/{iter-fest.iteratorFindLast.d.ts → iter-fest.iterableFindLast.d.ts} +5 -5
  87. package/dist/{iter-fest.iteratorFindLast.js → iter-fest.iterableFindLast.js} +10 -23
  88. package/dist/iter-fest.iterableFindLast.js.map +1 -0
  89. package/dist/iter-fest.iterableFindLast.mjs +7 -0
  90. package/dist/{iter-fest.iteratorFindLastIndex.d.mts → iter-fest.iterableFindLastIndex.d.mts} +4 -4
  91. package/dist/{iter-fest.iteratorFindLastIndex.d.ts → iter-fest.iterableFindLastIndex.d.ts} +4 -4
  92. package/dist/{iter-fest.iteratorFindLastIndex.js → iter-fest.iterableFindLastIndex.js} +10 -23
  93. package/dist/iter-fest.iterableFindLastIndex.js.map +1 -0
  94. package/dist/iter-fest.iterableFindLastIndex.mjs +7 -0
  95. package/dist/iter-fest.iterableForEach.d.mts +10 -0
  96. package/dist/iter-fest.iterableForEach.d.ts +10 -0
  97. package/dist/iter-fest.iterableForEach.js +40 -0
  98. package/dist/iter-fest.iterableForEach.js.map +1 -0
  99. package/dist/iter-fest.iterableForEach.mjs +7 -0
  100. package/dist/iter-fest.iterableGetReadable.d.mts +3 -0
  101. package/dist/iter-fest.iterableGetReadable.d.ts +3 -0
  102. package/dist/{iter-fest.readableStreamFrom.js → iter-fest.iterableGetReadable.js} +9 -9
  103. package/dist/iter-fest.iterableGetReadable.js.map +1 -0
  104. package/dist/iter-fest.iterableGetReadable.mjs +7 -0
  105. package/dist/iter-fest.iterableIncludes.d.mts +9 -0
  106. package/dist/iter-fest.iterableIncludes.d.ts +9 -0
  107. package/dist/{iter-fest.iteratorIncludes.js → iter-fest.iterableIncludes.js} +10 -21
  108. package/dist/iter-fest.iterableIncludes.js.map +1 -0
  109. package/dist/iter-fest.iterableIncludes.mjs +8 -0
  110. package/dist/iter-fest.iterableIndexOf.d.mts +9 -0
  111. package/dist/iter-fest.iterableIndexOf.d.ts +9 -0
  112. package/dist/{iter-fest.iteratorIndexOf.js → iter-fest.iterableIndexOf.js} +10 -21
  113. package/dist/iter-fest.iterableIndexOf.js.map +1 -0
  114. package/dist/iter-fest.iterableIndexOf.mjs +8 -0
  115. package/dist/iter-fest.iterableJoin.d.mts +8 -0
  116. package/dist/iter-fest.iterableJoin.d.ts +8 -0
  117. package/dist/{iter-fest.iteratorToString.js → iter-fest.iterableJoin.js} +9 -27
  118. package/dist/iter-fest.iterableJoin.js.map +1 -0
  119. package/dist/iter-fest.iterableJoin.mjs +7 -0
  120. package/dist/iter-fest.iterableKeys.d.mts +6 -0
  121. package/dist/iter-fest.iterableKeys.d.ts +6 -0
  122. package/dist/{iter-fest.iteratorKeys.js → iter-fest.iterableKeys.js} +9 -22
  123. package/dist/iter-fest.iterableKeys.js.map +1 -0
  124. package/dist/iter-fest.iterableKeys.mjs +7 -0
  125. package/dist/iter-fest.iterableMap.d.mts +8 -0
  126. package/dist/iter-fest.iterableMap.d.ts +8 -0
  127. package/dist/iter-fest.iterableMap.js +39 -0
  128. package/dist/iter-fest.iterableMap.js.map +1 -0
  129. package/dist/iter-fest.iterableMap.mjs +7 -0
  130. package/dist/{iter-fest.iteratorReduce.d.mts → iter-fest.iterableReduce.d.mts} +9 -13
  131. package/dist/{iter-fest.iteratorReduce.d.ts → iter-fest.iterableReduce.d.ts} +9 -13
  132. package/dist/iter-fest.iterableReduce.js +41 -0
  133. package/dist/iter-fest.iterableReduce.js.map +1 -0
  134. package/dist/iter-fest.iterableReduce.mjs +7 -0
  135. package/dist/{iter-fest.iteratorSlice.d.mts → iter-fest.iterableSlice.d.mts} +8 -8
  136. package/dist/{iter-fest.iteratorSlice.d.ts → iter-fest.iterableSlice.d.ts} +8 -8
  137. package/dist/{iter-fest.iteratorSlice.js → iter-fest.iterableSlice.js} +10 -21
  138. package/dist/iter-fest.iterableSlice.js.map +1 -0
  139. package/dist/iter-fest.iterableSlice.mjs +8 -0
  140. package/dist/iter-fest.iterableSome.d.mts +12 -0
  141. package/dist/iter-fest.iterableSome.d.ts +12 -0
  142. package/dist/iter-fest.iterableSome.js +43 -0
  143. package/dist/iter-fest.iterableSome.js.map +1 -0
  144. package/dist/iter-fest.iterableSome.mjs +7 -0
  145. package/dist/{iter-fest.iteratorToSpliced.d.mts → iter-fest.iterableToSpliced.d.mts} +3 -3
  146. package/dist/{iter-fest.iteratorToSpliced.d.ts → iter-fest.iterableToSpliced.d.ts} +3 -3
  147. package/dist/{iter-fest.iteratorToSpliced.js → iter-fest.iterableToSpliced.js} +10 -21
  148. package/dist/iter-fest.iterableToSpliced.js.map +1 -0
  149. package/dist/iter-fest.iterableToSpliced.mjs +8 -0
  150. package/dist/iter-fest.iterableToString.d.mts +6 -0
  151. package/dist/iter-fest.iterableToString.d.ts +6 -0
  152. package/dist/{iter-fest.iteratorJoin.js → iter-fest.iterableToString.js} +15 -21
  153. package/dist/iter-fest.iterableToString.js.map +1 -0
  154. package/dist/iter-fest.iterableToString.mjs +8 -0
  155. package/dist/iter-fest.js +237 -370
  156. package/dist/iter-fest.js.map +1 -1
  157. package/dist/iter-fest.mjs +76 -152
  158. package/dist/iter-fest.pushAsyncIterableIterator.d.mts +9 -0
  159. package/dist/iter-fest.pushAsyncIterableIterator.d.ts +9 -0
  160. package/dist/{iter-fest.iterableWritableStream.js → iter-fest.pushAsyncIterableIterator.js} +30 -39
  161. package/dist/iter-fest.pushAsyncIterableIterator.js.map +1 -0
  162. package/dist/iter-fest.pushAsyncIterableIterator.mjs +7 -0
  163. package/dist/iter-fest.readerValues.d.mts +3 -0
  164. package/dist/iter-fest.readerValues.d.ts +3 -0
  165. package/dist/{iter-fest.readableStreamValues.js → iter-fest.readerValues.js} +9 -10
  166. package/dist/iter-fest.readerValues.js.map +1 -0
  167. package/dist/iter-fest.readerValues.mjs +7 -0
  168. package/package.json +117 -307
  169. package/dist/chunk-3S6LCGE6.mjs +0 -10
  170. package/dist/chunk-3S6LCGE6.mjs.map +0 -1
  171. package/dist/chunk-4RT2FROS.mjs +0 -10
  172. package/dist/chunk-4RT2FROS.mjs.map +0 -1
  173. package/dist/chunk-4ZBMXHD6.mjs +0 -10
  174. package/dist/chunk-4ZBMXHD6.mjs.map +0 -1
  175. package/dist/chunk-72AEHTPQ.mjs +0 -38
  176. package/dist/chunk-72AEHTPQ.mjs.map +0 -1
  177. package/dist/chunk-AN54W42O.mjs.map +0 -1
  178. package/dist/chunk-AOZVPHE4.mjs +0 -10
  179. package/dist/chunk-AOZVPHE4.mjs.map +0 -1
  180. package/dist/chunk-BSAPKNNZ.mjs +0 -16
  181. package/dist/chunk-BSAPKNNZ.mjs.map +0 -1
  182. package/dist/chunk-BWMXKULC.mjs +0 -46
  183. package/dist/chunk-BWMXKULC.mjs.map +0 -1
  184. package/dist/chunk-CNCNQPK3.mjs +0 -16
  185. package/dist/chunk-CNCNQPK3.mjs.map +0 -1
  186. package/dist/chunk-CNKIGQUS.mjs +0 -10
  187. package/dist/chunk-CNKIGQUS.mjs.map +0 -1
  188. package/dist/chunk-DC2ZV7KQ.mjs +0 -10
  189. package/dist/chunk-DC2ZV7KQ.mjs.map +0 -1
  190. package/dist/chunk-EQZQP6GW.mjs.map +0 -1
  191. package/dist/chunk-FBST4AUL.mjs +0 -10
  192. package/dist/chunk-FBST4AUL.mjs.map +0 -1
  193. package/dist/chunk-FEEBFWAI.mjs +0 -24
  194. package/dist/chunk-FEEBFWAI.mjs.map +0 -1
  195. package/dist/chunk-FMIHIL6A.mjs +0 -10
  196. package/dist/chunk-FMIHIL6A.mjs.map +0 -1
  197. package/dist/chunk-GFJGWVES.mjs +0 -10
  198. package/dist/chunk-GFJGWVES.mjs.map +0 -1
  199. package/dist/chunk-H27CTQGV.mjs.map +0 -1
  200. package/dist/chunk-H5ARVU55.mjs.map +0 -1
  201. package/dist/chunk-IZXDQ25M.mjs.map +0 -1
  202. package/dist/chunk-J3FQSENW.mjs +0 -10
  203. package/dist/chunk-J3FQSENW.mjs.map +0 -1
  204. package/dist/chunk-JVR6BUJA.mjs +0 -10
  205. package/dist/chunk-JVR6BUJA.mjs.map +0 -1
  206. package/dist/chunk-K4RCFPTZ.mjs +0 -10
  207. package/dist/chunk-K4RCFPTZ.mjs.map +0 -1
  208. package/dist/chunk-LB3MK3EU.mjs +0 -10
  209. package/dist/chunk-LB3MK3EU.mjs.map +0 -1
  210. package/dist/chunk-LIMQXDFK.mjs +0 -10
  211. package/dist/chunk-LIMQXDFK.mjs.map +0 -1
  212. package/dist/chunk-MO7HMLOZ.mjs +0 -24
  213. package/dist/chunk-MO7HMLOZ.mjs.map +0 -1
  214. package/dist/chunk-MYSNSDM7.mjs +0 -13
  215. package/dist/chunk-MYSNSDM7.mjs.map +0 -1
  216. package/dist/chunk-NLXKATXE.mjs +0 -10
  217. package/dist/chunk-NLXKATXE.mjs.map +0 -1
  218. package/dist/chunk-NZRXO7EY.mjs +0 -24
  219. package/dist/chunk-NZRXO7EY.mjs.map +0 -1
  220. package/dist/chunk-OCK7PKGO.mjs +0 -23
  221. package/dist/chunk-OCK7PKGO.mjs.map +0 -1
  222. package/dist/chunk-ODPKEUIR.mjs +0 -10
  223. package/dist/chunk-ODPKEUIR.mjs.map +0 -1
  224. package/dist/chunk-OWUGLCQB.mjs +0 -10
  225. package/dist/chunk-OWUGLCQB.mjs.map +0 -1
  226. package/dist/chunk-PGJSIDLV.mjs +0 -25
  227. package/dist/chunk-PGJSIDLV.mjs.map +0 -1
  228. package/dist/chunk-QLVU73KN.mjs +0 -10
  229. package/dist/chunk-QLVU73KN.mjs.map +0 -1
  230. package/dist/chunk-R6SXIXMH.mjs +0 -10
  231. package/dist/chunk-R6SXIXMH.mjs.map +0 -1
  232. package/dist/chunk-RVIERPEV.mjs.map +0 -1
  233. package/dist/chunk-S2LECQKY.mjs +0 -10
  234. package/dist/chunk-S2LECQKY.mjs.map +0 -1
  235. package/dist/chunk-TDHR35S7.mjs +0 -10
  236. package/dist/chunk-TDHR35S7.mjs.map +0 -1
  237. package/dist/chunk-VCKLUCOT.mjs +0 -10
  238. package/dist/chunk-VCKLUCOT.mjs.map +0 -1
  239. package/dist/chunk-VIMGYUMQ.mjs +0 -10
  240. package/dist/chunk-VIMGYUMQ.mjs.map +0 -1
  241. package/dist/chunk-WUFMEPOM.mjs +0 -10
  242. package/dist/chunk-WUFMEPOM.mjs.map +0 -1
  243. package/dist/chunk-XQDGXAAF.mjs +0 -10
  244. package/dist/chunk-XQDGXAAF.mjs.map +0 -1
  245. package/dist/chunk-YJSIVBF7.mjs.map +0 -1
  246. package/dist/iter-fest.asyncIteratorDrop.d.mts +0 -12
  247. package/dist/iter-fest.asyncIteratorDrop.d.ts +0 -12
  248. package/dist/iter-fest.asyncIteratorDrop.js +0 -44
  249. package/dist/iter-fest.asyncIteratorDrop.js.map +0 -1
  250. package/dist/iter-fest.asyncIteratorDrop.mjs +0 -7
  251. package/dist/iter-fest.asyncIteratorEvery.d.mts +0 -25
  252. package/dist/iter-fest.asyncIteratorEvery.d.ts +0 -25
  253. package/dist/iter-fest.asyncIteratorEvery.js +0 -44
  254. package/dist/iter-fest.asyncIteratorEvery.js.map +0 -1
  255. package/dist/iter-fest.asyncIteratorEvery.mjs +0 -7
  256. package/dist/iter-fest.asyncIteratorFilter.d.mts +0 -18
  257. package/dist/iter-fest.asyncIteratorFilter.d.ts +0 -18
  258. package/dist/iter-fest.asyncIteratorFilter.js +0 -44
  259. package/dist/iter-fest.asyncIteratorFilter.js.map +0 -1
  260. package/dist/iter-fest.asyncIteratorFilter.mjs +0 -7
  261. package/dist/iter-fest.asyncIteratorFind.d.mts +0 -14
  262. package/dist/iter-fest.asyncIteratorFind.d.ts +0 -14
  263. package/dist/iter-fest.asyncIteratorFind.js +0 -44
  264. package/dist/iter-fest.asyncIteratorFind.js.map +0 -1
  265. package/dist/iter-fest.asyncIteratorFind.mjs +0 -7
  266. package/dist/iter-fest.asyncIteratorFlatMap.d.mts +0 -12
  267. package/dist/iter-fest.asyncIteratorFlatMap.d.ts +0 -12
  268. package/dist/iter-fest.asyncIteratorFlatMap.js +0 -44
  269. package/dist/iter-fest.asyncIteratorFlatMap.js.map +0 -1
  270. package/dist/iter-fest.asyncIteratorFlatMap.mjs +0 -7
  271. package/dist/iter-fest.asyncIteratorForEach.d.mts +0 -10
  272. package/dist/iter-fest.asyncIteratorForEach.d.ts +0 -10
  273. package/dist/iter-fest.asyncIteratorForEach.js +0 -44
  274. package/dist/iter-fest.asyncIteratorForEach.js.map +0 -1
  275. package/dist/iter-fest.asyncIteratorForEach.mjs +0 -7
  276. package/dist/iter-fest.asyncIteratorFrom.d.mts +0 -10
  277. package/dist/iter-fest.asyncIteratorFrom.d.ts +0 -10
  278. package/dist/iter-fest.asyncIteratorFrom.js +0 -44
  279. package/dist/iter-fest.asyncIteratorFrom.js.map +0 -1
  280. package/dist/iter-fest.asyncIteratorFrom.mjs +0 -7
  281. package/dist/iter-fest.asyncIteratorMap.d.mts +0 -10
  282. package/dist/iter-fest.asyncIteratorMap.d.ts +0 -10
  283. package/dist/iter-fest.asyncIteratorMap.js +0 -44
  284. package/dist/iter-fest.asyncIteratorMap.js.map +0 -1
  285. package/dist/iter-fest.asyncIteratorMap.mjs +0 -7
  286. package/dist/iter-fest.asyncIteratorReduce.d.mts +0 -23
  287. package/dist/iter-fest.asyncIteratorReduce.d.ts +0 -23
  288. package/dist/iter-fest.asyncIteratorReduce.js +0 -44
  289. package/dist/iter-fest.asyncIteratorReduce.js.map +0 -1
  290. package/dist/iter-fest.asyncIteratorReduce.mjs +0 -7
  291. package/dist/iter-fest.asyncIteratorSome.d.mts +0 -10
  292. package/dist/iter-fest.asyncIteratorSome.d.ts +0 -10
  293. package/dist/iter-fest.asyncIteratorSome.js +0 -44
  294. package/dist/iter-fest.asyncIteratorSome.js.map +0 -1
  295. package/dist/iter-fest.asyncIteratorSome.mjs +0 -7
  296. package/dist/iter-fest.asyncIteratorTake.d.mts +0 -12
  297. package/dist/iter-fest.asyncIteratorTake.d.ts +0 -12
  298. package/dist/iter-fest.asyncIteratorTake.js +0 -44
  299. package/dist/iter-fest.asyncIteratorTake.js.map +0 -1
  300. package/dist/iter-fest.asyncIteratorTake.mjs +0 -7
  301. package/dist/iter-fest.asyncIteratorToArray.d.mts +0 -10
  302. package/dist/iter-fest.asyncIteratorToArray.d.ts +0 -10
  303. package/dist/iter-fest.asyncIteratorToArray.js +0 -44
  304. package/dist/iter-fest.asyncIteratorToArray.js.map +0 -1
  305. package/dist/iter-fest.asyncIteratorToArray.mjs +0 -7
  306. package/dist/iter-fest.iterableWritableStream.d.mts +0 -7
  307. package/dist/iter-fest.iterableWritableStream.d.ts +0 -7
  308. package/dist/iter-fest.iterableWritableStream.js.map +0 -1
  309. package/dist/iter-fest.iterableWritableStream.mjs +0 -7
  310. package/dist/iter-fest.iteratorAt.js.map +0 -1
  311. package/dist/iter-fest.iteratorAt.mjs +0 -9
  312. package/dist/iter-fest.iteratorConcat.d.mts +0 -16
  313. package/dist/iter-fest.iteratorConcat.d.ts +0 -16
  314. package/dist/iter-fest.iteratorConcat.js +0 -56
  315. package/dist/iter-fest.iteratorConcat.js.map +0 -1
  316. package/dist/iter-fest.iteratorConcat.mjs +0 -8
  317. package/dist/iter-fest.iteratorDrop.d.mts +0 -12
  318. package/dist/iter-fest.iteratorDrop.d.ts +0 -12
  319. package/dist/iter-fest.iteratorDrop.js +0 -44
  320. package/dist/iter-fest.iteratorDrop.js.map +0 -1
  321. package/dist/iter-fest.iteratorDrop.mjs +0 -7
  322. package/dist/iter-fest.iteratorEntries.d.mts +0 -6
  323. package/dist/iter-fest.iteratorEntries.d.ts +0 -6
  324. package/dist/iter-fest.iteratorEntries.js.map +0 -1
  325. package/dist/iter-fest.iteratorEntries.mjs +0 -8
  326. package/dist/iter-fest.iteratorEvery.d.mts +0 -25
  327. package/dist/iter-fest.iteratorEvery.d.ts +0 -25
  328. package/dist/iter-fest.iteratorEvery.js +0 -44
  329. package/dist/iter-fest.iteratorEvery.js.map +0 -1
  330. package/dist/iter-fest.iteratorEvery.mjs +0 -7
  331. package/dist/iter-fest.iteratorFilter.d.mts +0 -18
  332. package/dist/iter-fest.iteratorFilter.d.ts +0 -18
  333. package/dist/iter-fest.iteratorFilter.js +0 -44
  334. package/dist/iter-fest.iteratorFilter.js.map +0 -1
  335. package/dist/iter-fest.iteratorFilter.mjs +0 -7
  336. package/dist/iter-fest.iteratorFind.d.mts +0 -14
  337. package/dist/iter-fest.iteratorFind.d.ts +0 -14
  338. package/dist/iter-fest.iteratorFind.js +0 -44
  339. package/dist/iter-fest.iteratorFind.js.map +0 -1
  340. package/dist/iter-fest.iteratorFind.mjs +0 -7
  341. package/dist/iter-fest.iteratorFindIndex.js.map +0 -1
  342. package/dist/iter-fest.iteratorFindIndex.mjs +0 -8
  343. package/dist/iter-fest.iteratorFindLast.js.map +0 -1
  344. package/dist/iter-fest.iteratorFindLast.mjs +0 -8
  345. package/dist/iter-fest.iteratorFindLastIndex.js.map +0 -1
  346. package/dist/iter-fest.iteratorFindLastIndex.mjs +0 -8
  347. package/dist/iter-fest.iteratorFlatMap.d.mts +0 -12
  348. package/dist/iter-fest.iteratorFlatMap.d.ts +0 -12
  349. package/dist/iter-fest.iteratorFlatMap.js +0 -44
  350. package/dist/iter-fest.iteratorFlatMap.js.map +0 -1
  351. package/dist/iter-fest.iteratorFlatMap.mjs +0 -7
  352. package/dist/iter-fest.iteratorFlatMap.mjs.map +0 -1
  353. package/dist/iter-fest.iteratorForEach.d.mts +0 -10
  354. package/dist/iter-fest.iteratorForEach.d.ts +0 -10
  355. package/dist/iter-fest.iteratorForEach.js +0 -44
  356. package/dist/iter-fest.iteratorForEach.js.map +0 -1
  357. package/dist/iter-fest.iteratorForEach.mjs +0 -7
  358. package/dist/iter-fest.iteratorForEach.mjs.map +0 -1
  359. package/dist/iter-fest.iteratorFrom.d.mts +0 -10
  360. package/dist/iter-fest.iteratorFrom.d.ts +0 -10
  361. package/dist/iter-fest.iteratorFrom.js +0 -44
  362. package/dist/iter-fest.iteratorFrom.js.map +0 -1
  363. package/dist/iter-fest.iteratorFrom.mjs +0 -7
  364. package/dist/iter-fest.iteratorFrom.mjs.map +0 -1
  365. package/dist/iter-fest.iteratorIncludes.d.mts +0 -9
  366. package/dist/iter-fest.iteratorIncludes.d.ts +0 -9
  367. package/dist/iter-fest.iteratorIncludes.js.map +0 -1
  368. package/dist/iter-fest.iteratorIncludes.mjs +0 -9
  369. package/dist/iter-fest.iteratorIncludes.mjs.map +0 -1
  370. package/dist/iter-fest.iteratorIndexOf.d.mts +0 -9
  371. package/dist/iter-fest.iteratorIndexOf.d.ts +0 -9
  372. package/dist/iter-fest.iteratorIndexOf.js.map +0 -1
  373. package/dist/iter-fest.iteratorIndexOf.mjs +0 -9
  374. package/dist/iter-fest.iteratorIndexOf.mjs.map +0 -1
  375. package/dist/iter-fest.iteratorJoin.d.mts +0 -8
  376. package/dist/iter-fest.iteratorJoin.d.ts +0 -8
  377. package/dist/iter-fest.iteratorJoin.js.map +0 -1
  378. package/dist/iter-fest.iteratorJoin.mjs +0 -8
  379. package/dist/iter-fest.iteratorJoin.mjs.map +0 -1
  380. package/dist/iter-fest.iteratorKeys.d.mts +0 -6
  381. package/dist/iter-fest.iteratorKeys.d.ts +0 -6
  382. package/dist/iter-fest.iteratorKeys.js.map +0 -1
  383. package/dist/iter-fest.iteratorKeys.mjs +0 -8
  384. package/dist/iter-fest.iteratorKeys.mjs.map +0 -1
  385. package/dist/iter-fest.iteratorMap.d.mts +0 -10
  386. package/dist/iter-fest.iteratorMap.d.ts +0 -10
  387. package/dist/iter-fest.iteratorMap.js +0 -44
  388. package/dist/iter-fest.iteratorMap.js.map +0 -1
  389. package/dist/iter-fest.iteratorMap.mjs +0 -7
  390. package/dist/iter-fest.iteratorMap.mjs.map +0 -1
  391. package/dist/iter-fest.iteratorReduce.js +0 -44
  392. package/dist/iter-fest.iteratorReduce.js.map +0 -1
  393. package/dist/iter-fest.iteratorReduce.mjs +0 -7
  394. package/dist/iter-fest.iteratorReduce.mjs.map +0 -1
  395. package/dist/iter-fest.iteratorSlice.js.map +0 -1
  396. package/dist/iter-fest.iteratorSlice.mjs +0 -9
  397. package/dist/iter-fest.iteratorSlice.mjs.map +0 -1
  398. package/dist/iter-fest.iteratorSome.d.mts +0 -10
  399. package/dist/iter-fest.iteratorSome.d.ts +0 -10
  400. package/dist/iter-fest.iteratorSome.js +0 -44
  401. package/dist/iter-fest.iteratorSome.js.map +0 -1
  402. package/dist/iter-fest.iteratorSome.mjs +0 -7
  403. package/dist/iter-fest.iteratorSome.mjs.map +0 -1
  404. package/dist/iter-fest.iteratorTake.d.mts +0 -12
  405. package/dist/iter-fest.iteratorTake.d.ts +0 -12
  406. package/dist/iter-fest.iteratorTake.js +0 -44
  407. package/dist/iter-fest.iteratorTake.js.map +0 -1
  408. package/dist/iter-fest.iteratorTake.mjs +0 -7
  409. package/dist/iter-fest.iteratorTake.mjs.map +0 -1
  410. package/dist/iter-fest.iteratorToArray.d.mts +0 -10
  411. package/dist/iter-fest.iteratorToArray.d.ts +0 -10
  412. package/dist/iter-fest.iteratorToArray.js +0 -44
  413. package/dist/iter-fest.iteratorToArray.js.map +0 -1
  414. package/dist/iter-fest.iteratorToArray.mjs +0 -7
  415. package/dist/iter-fest.iteratorToArray.mjs.map +0 -1
  416. package/dist/iter-fest.iteratorToAsync.d.mts +0 -10
  417. package/dist/iter-fest.iteratorToAsync.d.ts +0 -10
  418. package/dist/iter-fest.iteratorToAsync.js +0 -44
  419. package/dist/iter-fest.iteratorToAsync.js.map +0 -1
  420. package/dist/iter-fest.iteratorToAsync.mjs +0 -7
  421. package/dist/iter-fest.iteratorToAsync.mjs.map +0 -1
  422. package/dist/iter-fest.iteratorToSpliced.js.map +0 -1
  423. package/dist/iter-fest.iteratorToSpliced.mjs +0 -9
  424. package/dist/iter-fest.iteratorToSpliced.mjs.map +0 -1
  425. package/dist/iter-fest.iteratorToString.d.mts +0 -6
  426. package/dist/iter-fest.iteratorToString.d.ts +0 -6
  427. package/dist/iter-fest.iteratorToString.js.map +0 -1
  428. package/dist/iter-fest.iteratorToString.mjs +0 -9
  429. package/dist/iter-fest.iteratorToString.mjs.map +0 -1
  430. package/dist/iter-fest.observableValues.d.mts +0 -7
  431. package/dist/iter-fest.observableValues.d.ts +0 -7
  432. package/dist/iter-fest.observableValues.js +0 -102
  433. package/dist/iter-fest.observableValues.js.map +0 -1
  434. package/dist/iter-fest.observableValues.mjs +0 -9
  435. package/dist/iter-fest.observableValues.mjs.map +0 -1
  436. package/dist/iter-fest.readableStreamFrom.d.mts +0 -3
  437. package/dist/iter-fest.readableStreamFrom.d.ts +0 -3
  438. package/dist/iter-fest.readableStreamFrom.js.map +0 -1
  439. package/dist/iter-fest.readableStreamFrom.mjs +0 -7
  440. package/dist/iter-fest.readableStreamFrom.mjs.map +0 -1
  441. package/dist/iter-fest.readableStreamValues.d.mts +0 -3
  442. package/dist/iter-fest.readableStreamValues.d.ts +0 -3
  443. package/dist/iter-fest.readableStreamValues.js.map +0 -1
  444. package/dist/iter-fest.readableStreamValues.mjs +0 -7
  445. package/dist/iter-fest.readableStreamValues.mjs.map +0 -1
  446. /package/dist/{iter-fest.asyncIteratorDrop.mjs.map → iter-fest.iterableAt.mjs.map} +0 -0
  447. /package/dist/{iter-fest.asyncIteratorEvery.mjs.map → iter-fest.iterableConcat.mjs.map} +0 -0
  448. /package/dist/{iter-fest.asyncIteratorFilter.mjs.map → iter-fest.iterableEntries.mjs.map} +0 -0
  449. /package/dist/{iter-fest.asyncIteratorFind.mjs.map → iter-fest.iterableEvery.mjs.map} +0 -0
  450. /package/dist/{iter-fest.asyncIteratorFlatMap.mjs.map → iter-fest.iterableFilter.mjs.map} +0 -0
  451. /package/dist/{iter-fest.asyncIteratorForEach.mjs.map → iter-fest.iterableFind.mjs.map} +0 -0
  452. /package/dist/{iter-fest.asyncIteratorFrom.mjs.map → iter-fest.iterableFindIndex.mjs.map} +0 -0
  453. /package/dist/{iter-fest.asyncIteratorMap.mjs.map → iter-fest.iterableFindLast.mjs.map} +0 -0
  454. /package/dist/{iter-fest.asyncIteratorReduce.mjs.map → iter-fest.iterableFindLastIndex.mjs.map} +0 -0
  455. /package/dist/{iter-fest.asyncIteratorSome.mjs.map → iter-fest.iterableForEach.mjs.map} +0 -0
  456. /package/dist/{iter-fest.asyncIteratorTake.mjs.map → iter-fest.iterableGetReadable.mjs.map} +0 -0
  457. /package/dist/{iter-fest.asyncIteratorToArray.mjs.map → iter-fest.iterableIncludes.mjs.map} +0 -0
  458. /package/dist/{iter-fest.iterableWritableStream.mjs.map → iter-fest.iterableIndexOf.mjs.map} +0 -0
  459. /package/dist/{iter-fest.iteratorAt.mjs.map → iter-fest.iterableJoin.mjs.map} +0 -0
  460. /package/dist/{iter-fest.iteratorConcat.mjs.map → iter-fest.iterableKeys.mjs.map} +0 -0
  461. /package/dist/{iter-fest.iteratorDrop.mjs.map → iter-fest.iterableMap.mjs.map} +0 -0
  462. /package/dist/{iter-fest.iteratorEntries.mjs.map → iter-fest.iterableReduce.mjs.map} +0 -0
  463. /package/dist/{iter-fest.iteratorEvery.mjs.map → iter-fest.iterableSlice.mjs.map} +0 -0
  464. /package/dist/{iter-fest.iteratorFilter.mjs.map → iter-fest.iterableSome.mjs.map} +0 -0
  465. /package/dist/{iter-fest.iteratorFind.mjs.map → iter-fest.iterableToSpliced.mjs.map} +0 -0
  466. /package/dist/{iter-fest.iteratorFindIndex.mjs.map → iter-fest.iterableToString.mjs.map} +0 -0
  467. /package/dist/{iter-fest.iteratorFindLast.mjs.map → iter-fest.pushAsyncIterableIterator.mjs.map} +0 -0
  468. /package/dist/{iter-fest.iteratorFindLastIndex.mjs.map → iter-fest.readerValues.mjs.map} +0 -0
package/README.md CHANGED
@@ -18,23 +18,18 @@ npm install iter-fest
18
18
 
19
19
  ## Conversions
20
20
 
21
- | From | To | Function |
22
- | -------------------------- | ----------------------- | ------------------------------------------------------------------------------- |
23
- | `Iterator` | `IterableIterator` | [`iteratorToIterable`](#converting-an-iterator-to-iterable) |
24
- | `AsyncIterator` | `AsyncIterableIterator` | [`asyncIteratorToAsyncIterable`](#converting-an-iterator-to-iterable) |
25
- | `Observable` | `ReadableStream` | [`observableSubscribeAsReadable`](#converting-an-observable-to-readablestream) |
26
- | `ReadableStream` | `AsyncIterableIterator` | [`readableStreamValues`](#converting-a-readablestream-to-asynciterableiterator) |
27
- | `AsyncIterable` | `Observable` | [`observableFromAsync`](#converting-an-asynciterable-to-observable) |
28
- | `AsyncIterable`/`Iterable` | `ReadableStream` | [`readableStreamFrom`](#converting-an-asynciterableiterable-to-readablestream) |
29
- | `Observable` | `AsyncIterableIterator` | [`observableValues`](#converting-an-observable-to-asynciterableiterator) |
21
+ | From | To | Function signature |
22
+ | ----------------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
23
+ | `Iterator` | `IterableIterator` | [`iteratorToIterable<T>(iterator: Iterator<T>): IterableIterator<T>`](#converting-an-iterator-to-iterable) |
24
+ | `AsyncIterator` | `AsyncIterableIterator` | [`asyncIteratorToAsyncIterable<T>(asyncIterator: AsyncIterator<T>): AsyncIterableIterator<T>`](#converting-an-iterator-to-iterable) |
25
+ | `Observable` | `ReadableStream` | [`observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T>`](#converting-an-observable-to-readablestream) |
26
+ | `ReadableStreamDefaultReader` | `AsyncIterableIterator` | [`readerValues`<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T>`](#converting-a-readablestreamdefaultreader-to-asynciterableiterator) |
27
+ | `AsyncIterable` | `Observable` | [`observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T>`](#converting-an-asynciterable-to-observable) |
28
+ | `AsyncIterable`/`Iterable` | `ReadableStream` | [`iterableGetReadable<T>(iterable: AsyncIterable<T> \| Iterable<T>): ReadableStream<T>`](#converting-an-asynciterableiterable-to-readablestream) |
30
29
 
31
- ### Converting an iterator to iterable
32
-
33
- ```ts
34
- function iteratorToIterable<T>(iterator: Iterator<T>): IterableIterator<T>
30
+ To convert `Observable` to `AsyncIterableIterator`, [use `ReadableStream` as intermediate format](#converting-an-observable-to-asynciterableiterator).
35
31
 
36
- function asyncIteratorToAsyncIterable<T>(asyncIterator: AsyncIterator<T>): AsyncIterableIterator<T>
37
- ```
32
+ ### Converting an iterator to iterable
38
33
 
39
34
  `iteratorToIterable` and `asyncIteratorToAsyncIterable` enable a [pure iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator) to be iterable using a for-loop statement.
40
35
 
@@ -60,12 +55,26 @@ for (const value of iteratorToIterable(iterate())) {
60
55
 
61
56
  Note: calling `[Symbol.iterator]()` or `[Symbol.asyncIterator]()` will not restart the iteration. This is because iterator is an instance of iteration and is not restartable.
62
57
 
63
- ### Converting an `AsyncIterable` to `Observable`
58
+ ### Converting an `Observable` to `AsyncIterableIterator`
59
+
60
+ `ReadableStream` can be used as an intermediate format when converting an `Observable` to `AsyncIterableIterator`.
61
+
62
+ Note: `Observable` is push-based and it does not support flow control. When converting to `AsyncIterableIteratorrr`, the internal buffer of `ReadableStream` could build up quickly.
64
63
 
65
64
  ```ts
66
- function observableFromAsync<T>(iterable: AsyncIterable<T>): Observable<T>
65
+ const observable = Observable.from([1, 2, 3]);
66
+ const readable = observableSubscribeAsReadable(observable);
67
+ const iterable = readerValues(readable.getReader());
68
+
69
+ for await (const value of iterable) {
70
+ console.log(value); // Prints "1", "2", "3".
71
+ }
67
72
  ```
68
73
 
74
+ Note: calling `[Symbol.asyncIterator]()` will not resubscribe and read from the start of the observable. This is because the intermediate format does not support restart.
75
+
76
+ ### Converting an `AsyncIterable` to `Observable`
77
+
69
78
  `Observable.from` converts `Iterable` into `Observable`. However, it does not convert `AsyncIterable`.
70
79
 
71
80
  `observableFromAsync` will convert `AsyncIterable` into `Observable`. It will try to restart the iteration by calling `[Symbol.asyncIterator]()`.
@@ -89,10 +98,6 @@ Note: It is not recommended to convert `AsyncGenerator` to an `Observable`. `Asy
89
98
 
90
99
  ### Converting an `Observable` to `ReadableStream`
91
100
 
92
- ```ts
93
- function observableSubscribeAsReadable<T>(observable: Observable<T>): ReadableStream<T>
94
- ```
95
-
96
101
  `ReadableStream` is powerful for transforming and piping stream of data. It can be formed using data from both push-based and pull-based source with backpressuree.
97
102
 
98
103
  Note: `Observable` is push-based and it does not support flow control. When converting to `ReadableStream`, the internal buffer could build up quickly.
@@ -104,16 +109,12 @@ const readable = observableSubscribeAsReadable(observable);
104
109
  readable.pipeTo(stream.writable); // Will write 1, 2, 3.
105
110
  ```
106
111
 
107
- ### Converting a `ReadableStream` to `AsyncIterableIterator`
108
-
109
- ```ts
110
- function readableStreamValues`<T>(readable: ReadableStream<T>): AsyncIterableIterator<T>
111
- ```
112
+ ### Converting a `ReadableStreamDefaultReader` to `AsyncIterableIterator`
112
113
 
113
- `readableStreamValues` allow iteration of `ReadableStream` as an `AsyncIterableIterator`.
114
+ `readerValues` will convert default reader of `ReadableStream` into an `AsyncIterableIterator` to use in for-loop.
114
115
 
115
116
  ```ts
116
- const readable = new ReadableStream({
117
+ const readableStream = new ReadableStream({
117
118
  start(controller) {
118
119
  controller.enqueue(1);
119
120
  controller.enqueue(2);
@@ -124,54 +125,25 @@ const readable = new ReadableStream({
124
125
  }
125
126
  });
126
127
 
127
- const iterable = readableStreamValues(readable);
128
+ const iterable = readerValues(readableStream.getReader());
128
129
 
129
130
  for await (const value of iterable) {
130
131
  console.log(value); // Prints "1", "2", "3".
131
132
  }
132
133
  ```
133
134
 
134
- Note: The stream will be locked as soon as the iterable is created. When using iterating outside of for-loop, make sure to call `AsyncIterator.return` when the iteration is done to release the lock on the stream.
135
-
136
- Note: `[Symbol.asyncIterator]()` will not restart the stream.
135
+ Note: `[Symbol.asyncIterator]()` will not restart the reader and read from start of the stream. Reader is not restartable and streams are not seekable.
137
136
 
138
137
  ### Converting an `AsyncIterable`/`Iterable` to `ReadableStream`
139
138
 
140
- ```ts
141
- function readableStreamFrom<T>(anyIterable: AsyncIterable<T> | Iterable<T>): ReadableStream<T>
142
- ```
143
-
144
- > Notes: this feature is part of [Streams Standard](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/from_static).
145
-
146
139
  ```ts
147
140
  const iterable = [1, 2, 3].values();
148
- const readable = readableStreamFrom(iterable);
141
+ const readable = iterableGetReadable(iterable);
149
142
 
150
143
  readable.pipeTo(stream.writable); // Will write 1, 2, 3.
151
144
  ```
152
145
 
153
- Note: `readableStreamFrom()` will call `[Symbol.iterator]()` initially to restart the iteration where possible.
154
-
155
- ### Converting an `Observable` to `AsyncIterableIterator`
156
-
157
- ```ts
158
- function observableValues<T>(observable: Observable<T>): AsyncIterableIterator<T>
159
- ```
160
-
161
- `Observable` can be converted to `AsyncIterableIterator` for easier consumption.
162
-
163
- ```ts
164
- const observable = Observable.from([1, 2, 3]);
165
- const iterable = observableValues(readable);
166
-
167
- for await (const value of iterable) {
168
- console.log(value); // Prints "1", "2", "3".
169
- }
170
- ```
171
-
172
- Note: `Observable` is push-based and it does not support flow control. When converting to `AsyncIterableIterator`, the internal buffer could build up quickly.
173
-
174
- Note: when the observable throw an exception via `observer.error()`, it will become rejection of `AsyncIterator.next()`. The exception will be hoisted back to the caller.
146
+ Note: `iterableGetReadable()` will call `[Symbol.iterator]()` initially to restart the iteration where possible.
175
147
 
176
148
  ## Others
177
149
 
@@ -181,18 +153,14 @@ Note: when the observable throw an exception via `observer.error()`, it will bec
181
153
 
182
154
  ### Producer-consumer queue
183
155
 
184
- `IterableWritableStream` is a push-based producer-consumer queue designed to decouple the flow between a producer and multiple consumers. The producer can push a new job at anytime. The consumer can pull a job at its own convenience via for-loop.
156
+ `PushAsyncIterableIterator` is a simple push-based producer-consumer queue and designed to decouple the flow between a producer and consumer. The producer can push a new job at anytime. The consumer can pull a job at its own convenience via for-loop.
185
157
 
186
- `IterableWritableStream` supports multiple consumers and continuation:
158
+ Compare to pull-based queue, a push-based queue is very easy to use. However, pull-based queue offers better flow control as it will produce a job only if there is a consumer ready to consume.
187
159
 
188
- - Multiple consumers: when 2 or more consumers are active at the same time, jobs will be distributed across all consumers in a round robin fashion when possible
189
- - Continuation: when the last consumer disconnected while producer keep pushing new jobs, the next consumer will pick up where the last consumer left
190
-
191
- Compare to pull-based queue, a push-based queue is easy to use. However, pull-based queue offers better flow control as it will produce a job only if there is a consumer ready to consume.
160
+ For a full-featured producer-consumer queue that supports flow control, use `ReadableStream` instead.
192
161
 
193
162
  ```ts
194
- const iterable = new IterableWritableStream();
195
- const writer = iterable.getWriter();
163
+ const iterable = new PushAsyncIterableIterator();
196
164
 
197
165
  (async function consumer() {
198
166
  for await (const value of iterable) {
@@ -203,10 +171,10 @@ const writer = iterable.getWriter();
203
171
  })();
204
172
 
205
173
  (async function producer() {
206
- writer.write(1);
207
- writer.write(2);
208
- writer.write(3);
209
- writer.close();
174
+ iterable.push(1);
175
+ iterable.push(2);
176
+ iterable.push(3);
177
+ iterable.close();
210
178
  })();
211
179
 
212
180
  // Prints "1", "2", "3", "Done".
@@ -250,51 +218,22 @@ const generator = generatorWithLastValue(
250
218
  );
251
219
  ```
252
220
 
253
- ## Adding types to `core-js-pure`
254
-
255
- We added types to [Iterator Helpers](https://github.com/tc39/proposal-iterator-helpers) and [Async Iterator Helpers](https://github.com/tc39/proposal-async-iterator-helpers) implementation from `core-js-pure`:
256
-
257
- - [`Iterator.drop`](https://tc39.es/ecma262/#sec-array.prototype.drop)
258
- - [`Iterator.every`](https://tc39.es/ecma262/#sec-array.prototype.every)
259
- - [`Iterator.filter`](https://tc39.es/ecma262/#sec-array.prototype.filter)
260
- - [`Iterator.find`](https://tc39.es/ecma262/#sec-array.prototype.find)
261
- - [`Iterator.flatMap`](https://tc39.es/ecma262/#sec-array.prototype.flatmap)
262
- - [`Iterator.forEach`](https://tc39.es/ecma262/#sec-array.prototype.foreach)
263
- - [`Iterator.from`](https://tc39.es/ecma262/#sec-array.prototype.from)
264
- - [`Iterator.map`](https://tc39.es/ecma262/#sec-array.prototype.map)
265
- - [`Iterator.reduce`](https://tc39.es/ecma262/#sec-array.prototype.reduce)
266
- - [`Iterator.some`](https://tc39.es/ecma262/#sec-array.prototype.some)
267
- - [`Iterator.take`](https://tc39.es/ecma262/#sec-array.prototype.take)
268
- - [`Iterator.toArray`](https://tc39.es/ecma262/#sec-array.prototype.toarray)
269
- - [`AsyncIterator.drop`](https://tc39.es/ecma262/#sec-array.prototype.drop)
270
- - [`AsyncIterator.every`](https://tc39.es/ecma262/#sec-array.prototype.every)
271
- - [`AsyncIterator.filter`](https://tc39.es/ecma262/#sec-array.prototype.filter)
272
- - [`AsyncIterator.find`](https://tc39.es/ecma262/#sec-array.prototype.find)
273
- - [`AsyncIterator.flatMap`](https://tc39.es/ecma262/#sec-array.prototype.flatmap)
274
- - [`AsyncIterator.forEach`](https://tc39.es/ecma262/#sec-array.prototype.foreach)
275
- - [`AsyncIterator.from`](https://tc39.es/ecma262/#sec-array.prototype.from)
276
- - [`AsyncIterator.map`](https://tc39.es/ecma262/#sec-array.prototype.map)
277
- - [`AsyncIterator.reduce`](https://tc39.es/ecma262/#sec-array.prototype.reduce)
278
- - [`AsyncIterator.some`](https://tc39.es/ecma262/#sec-array.prototype.some)
279
- - [`AsyncIterator.take`](https://tc39.es/ecma262/#sec-array.prototype.take)
280
- - [`AsyncIterator.toArray`](https://tc39.es/ecma262/#sec-array.prototype.toarray)
281
-
282
221
  ## `Array.prototype` ports
283
222
 
284
- We ported majority of functions from `Array.prototype.*` to `iterator*`.
223
+ We ported majority of functions from `Array.prototype.*` to `iterable*`.
285
224
 
286
225
  ```ts
287
- import { iteratorIncludes, iteratorReduce } from 'iter-fest'; // Via default exports.
288
- import { iteratorSome } from 'iter-fest/iteratorSome'; // Via named exports.
226
+ import { iterableIncludes, iterableReduce } from 'iter-fest'; // Via default exports.
227
+ import { iterableSome } from 'iter-fest/iterableSome'; // Via named exports.
289
228
 
290
- const iterator: iterator<number> = [1, 2, 3, 4, 5].values();
229
+ const iterable: Iterable<number> = [1, 2, 3, 4, 5].values();
291
230
 
292
- console.log(iteratorIncludes(iterator, 3)); // Prints "true".
293
- console.log(iteratorReduce(iterator, (sum, value) => sum + value, 0)); // Prints "15".
294
- console.log(iteratorSome(iterator, value => value % 2)); // Prints "true".
231
+ console.log(iterableIncludes(iterable, 3)); // Prints "true".
232
+ console.log(iterableReduce(iterable, (sum, value) => sum + value, 0)); // Prints "15".
233
+ console.log(iterableSome(iterable, value => value % 2)); // Prints "true".
295
234
  ```
296
235
 
297
- List of ported functions: [`at`](https://tc39.es/ecma262/#sec-array.prototype.at), [`concat`](https://tc39.es/ecma262/#sec-array.prototype.concat), [`entries`](https://tc39.es/ecma262/#sec-array.prototype.entries), [`findIndex`](https://tc39.es/ecma262/#sec-array.prototype.findindex), [`findLast`](https://tc39.es/ecma262/#sec-array.prototype.findlast), [`findLastIndex`](https://tc39.es/ecma262/#sec-array.prototype.findlastindex), [`includes`](https://tc39.es/ecma262/#sec-array.prototype.includes), [`indexOf`](https://tc39.es/ecma262/#sec-array.prototype.indexof), [`join`](https://tc39.es/ecma262/#sec-array.prototype.join), [`keys`](https://tc39.es/ecma262/#sec-array.prototype.keys), [`slice`](https://tc39.es/ecma262/#sec-array.prototype.slice), [`toSpliced`](https://tc39.es/ecma262/#sec-array.prototype.tospliced), and [`toString`](https://tc39.es/ecma262/#sec-array.prototype.tostring).
236
+ List of ported functions: [`at`](https://tc39.es/ecma262/#sec-array.prototype.at), [`concat`](https://tc39.es/ecma262/#sec-array.prototype.concat), [`entries`](https://tc39.es/ecma262/#sec-array.prototype.entries), [`every`](https://tc39.es/ecma262/#sec-array.prototype.every), [`filter`](https://tc39.es/ecma262/#sec-array.prototype.filter), [`find`](https://tc39.es/ecma262/#sec-array.prototype.find), [`findIndex`](https://tc39.es/ecma262/#sec-array.prototype.findindex), [`findLast`](https://tc39.es/ecma262/#sec-array.prototype.findlast), [`findLastIndex`](https://tc39.es/ecma262/#sec-array.prototype.findlastindex), [`forEach`](https://tc39.es/ecma262/#sec-array.prototype.foreach), [`includes`](https://tc39.es/ecma262/#sec-array.prototype.includes), [`indexOf`](https://tc39.es/ecma262/#sec-array.prototype.indexof), [`join`](https://tc39.es/ecma262/#sec-array.prototype.join), [`keys`](https://tc39.es/ecma262/#sec-array.prototype.keys), [`map`](https://tc39.es/ecma262/#sec-array.prototype.map), [`reduce`](https://tc39.es/ecma262/#sec-array.prototype.reduce), [`slice`](https://tc39.es/ecma262/#sec-array.prototype.slice), [`some`](https://tc39.es/ecma262/#sec-array.prototype.some), [`toSpliced`](https://tc39.es/ecma262/#sec-array.prototype.tospliced), and [`toString`](https://tc39.es/ecma262/#sec-array.prototype.tostring).
298
237
 
299
238
  ## Behaviors
300
239
 
@@ -311,27 +250,27 @@ Majority of functions should work the same way with same complexity and performa
311
250
  There are minor differences on some functions:
312
251
 
313
252
  - `findLast` and `findLastIndex`
314
- - Instead of iterating from the right side, iterators must start from left side
315
- - Thus, with an iterator of 5 items, `predicate` will be called exactly 5 times with `O(N)` complexity
253
+ - Instead of iterating from the right side, iterables must start from left side
254
+ - Thus, with an iterable of 5 items, `predicate` will be called exactly 5 times with `O(N)` complexity
316
255
  - In contrast, its counterpart in `Array` will be called between 1 and 5 times with `O(log N)` complexity
317
256
  - `at`, `includes`, `indexOf`, `slice`, and `toSpliced`
318
257
  - Index arguments cannot be negative finite number
319
- - Negative finite number means traversing from right side, which an iterator may not have an end
258
+ - Negative finite number means traversing from right side, which an iterator/iterable may not have an end
320
259
  - Infinites, zeroes, and positive numbers are supported
321
260
 
322
261
  ### Why `Array.prototype.push` is not ported?
323
262
 
324
- Some functions that modify the array are not ported, such as, `copyWithin`, `fill`, `pop`, `push`, `reverse`, `shift`, `splice`, `unshift`, etc. Iterators are read-only and we prefer to keep it that way.
263
+ Some functions that modify the array are not ported, such as, `copyWithin`, `fill`, `pop`, `push`, `reverse`, `shift`, `splice`, `unshift`, etc. Iterables are read-only and we prefer to keep it that way.
325
264
 
326
- Some functions that do not have actual functionality in the iterator world are not ported, such as, `values`, etc.
265
+ Some functions that do not have actual functionality in the iterable world are not ported, such as, `values`, etc.
327
266
 
328
267
  Some functions that cannot not retains their complexity or performance characteristics are not ported. These functions usually iterate from the other end or requires random access, such as, `lastIndexOf`, `reduceRight`, `sort`, `toReversed`, `toSorted`, etc.
329
268
 
330
269
  If you think a specific function should be ported, please submit a pull request to us.
331
270
 
332
- ### How about asynchronous iterators?
271
+ ### How about asynchronous iterables?
333
272
 
334
- Yes, this is on our roadmap. This will enable traverse iterators [across domains/workers via `MessagePort`](https://npmjs.com/package/message-port-rpc). We welcome pull requests.
273
+ Yes, this is on our roadmap. This will enable traverse iterables [across domains/workers via `MessagePort`](https://npmjs.com/package/message-port-rpc). We welcome pull requests.
335
274
 
336
275
  ### How about functions outside of `Array.prototype`?
337
276
 
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  toIntegerOrInfinity
3
3
  } from "./chunk-W5NEOEVE.mjs";
4
- import {
5
- iteratorToIterable
6
- } from "./chunk-MNDAEMYM.mjs";
7
4
 
8
- // src/iteratorIncludes.ts
9
- function iteratorIncludes(iterator, searchElement, fromIndex = 0) {
5
+ // src/iterableIncludes.ts
6
+ function iterableIncludes(iterable, searchElement, fromIndex = 0) {
10
7
  let index = 0;
11
8
  fromIndex = toIntegerOrInfinity(fromIndex);
12
9
  if (fromIndex !== Infinity) {
@@ -14,7 +11,7 @@ function iteratorIncludes(iterator, searchElement, fromIndex = 0) {
14
11
  if (fromIndex < 0) {
15
12
  throw new TypeError("fromIndex cannot be a negative finite number");
16
13
  }
17
- for (const item of iteratorToIterable(iterator)) {
14
+ for (const item of iterable) {
18
15
  if (index++ >= fromIndex && Object.is(item, searchElement)) {
19
16
  return true;
20
17
  }
@@ -24,6 +21,6 @@ function iteratorIncludes(iterator, searchElement, fromIndex = 0) {
24
21
  }
25
22
 
26
23
  export {
27
- iteratorIncludes
24
+ iterableIncludes
28
25
  };
29
- //# sourceMappingURL=chunk-H27CTQGV.mjs.map
26
+ //# sourceMappingURL=chunk-27NJVC7K.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableIncludes.ts"],"sourcesContent":["import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Determines whether an iterable includes a certain element, returning true or false as appropriate.\n *\n * @param searchElement The element to search for.\n * @param fromIndex The position in this iterable at which to begin searching for searchElement.\n */\nexport function iterableIncludes<T>(iterable: Iterable<T>, searchElement: T, fromIndex: number = 0): boolean {\n let index = 0;\n\n fromIndex = toIntegerOrInfinity(fromIndex);\n\n if (fromIndex !== Infinity) {\n fromIndex = fromIndex === -Infinity ? 0 : fromIndex;\n\n if (fromIndex < 0) {\n // TODO: Support negative fromIndex.\n throw new TypeError('fromIndex cannot be a negative finite number');\n }\n\n for (const item of iterable) {\n if (index++ >= fromIndex && Object.is(item, searchElement)) {\n return true;\n }\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;AAQO,SAAS,iBAAoB,UAAuB,eAAkB,YAAoB,GAAY;AAC3G,MAAI,QAAQ;AAEZ,cAAY,oBAAoB,SAAS;AAEzC,MAAI,cAAc,UAAU;AAC1B,gBAAY,cAAc,YAAY,IAAI;AAE1C,QAAI,YAAY,GAAG;AAEjB,YAAM,IAAI,UAAU,8CAA8C;AAAA,IACpE;AAEA,eAAW,QAAQ,UAAU;AAC3B,UAAI,WAAW,aAAa,OAAO,GAAG,MAAM,aAAa,GAAG;AAC1D,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,12 @@
1
+ // src/iterableEntries.ts
2
+ function* iterableEntries(iterable) {
3
+ let index = 0;
4
+ for (const value of iterable) {
5
+ yield [index++, value];
6
+ }
7
+ }
8
+
9
+ export {
10
+ iterableEntries
11
+ };
12
+ //# sourceMappingURL=chunk-44W7OTNE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableEntries.ts"],"sourcesContent":["/**\n * Returns an iterable of key, value pairs for every entry in the iterable\n */\nexport function* iterableEntries<T>(iterable: Iterable<T>): IterableIterator<[number, T]> {\n let index = 0;\n\n for (const value of iterable) {\n yield [index++, value];\n }\n}\n"],"mappings":";AAGO,UAAU,gBAAmB,UAAsD;AACxF,MAAI,QAAQ;AAEZ,aAAW,SAAS,UAAU;AAC5B,UAAM,CAAC,SAAS,KAAK;AAAA,EACvB;AACF;","names":[]}
@@ -0,0 +1,20 @@
1
+ // src/iterableJoin.ts
2
+ function iterableJoin(iterable, separator = ",") {
3
+ let index = 0;
4
+ let result = "";
5
+ for (const item of iterable) {
6
+ if (index) {
7
+ result += separator;
8
+ }
9
+ if (typeof item !== "undefined" && item !== null) {
10
+ result += item;
11
+ }
12
+ index++;
13
+ }
14
+ return result;
15
+ }
16
+
17
+ export {
18
+ iterableJoin
19
+ };
20
+ //# sourceMappingURL=chunk-5CHMNKXJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableJoin.ts"],"sourcesContent":["/**\n * Adds all the elements of an iterable into a string, separated by the specified separator string.\n *\n * @param separator A string used to separate one element of the iterable from the next in the resulting string. If omitted, the iterable elements are separated with a comma.\n */\nexport function iterableJoin<T>(iterable: Iterable<T>, separator: string = ','): string {\n let index = 0;\n let result = '';\n\n for (const item of iterable) {\n if (index) {\n result += separator;\n }\n\n if (typeof item !== 'undefined' && item !== null) {\n result += item;\n }\n\n index++;\n }\n\n return result;\n}\n"],"mappings":";AAKO,SAAS,aAAgB,UAAuB,YAAoB,KAAa;AACtF,MAAI,QAAQ;AACZ,MAAI,SAAS;AAEb,aAAW,QAAQ,UAAU;AAC3B,QAAI,OAAO;AACT,gBAAU;AAAA,IACZ;AAEA,QAAI,OAAO,SAAS,eAAe,SAAS,MAAM;AAChD,gBAAU;AAAA,IACZ;AAEA;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,19 @@
1
+ // src/iterableEvery.ts
2
+ function iterableEvery(iterable, predicate, thisArg = void 0) {
3
+ let index = 0;
4
+ if (typeof predicate !== "function") {
5
+ throw new TypeError(`${predicate} is not a function`);
6
+ }
7
+ const boundPredicate = predicate.bind(thisArg);
8
+ for (const value of iterable) {
9
+ if (!boundPredicate(value, index++, iterable)) {
10
+ return false;
11
+ }
12
+ }
13
+ return true;
14
+ }
15
+
16
+ export {
17
+ iterableEvery
18
+ };
19
+ //# sourceMappingURL=chunk-5CRMPYKD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableEvery.ts"],"sourcesContent":["/**\n * Determines whether all the members of an iterable satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterable until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the predicate function.\n * If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableEvery<T, S extends T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => value is S,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): iterable is S[];\n\n/**\n * Determines whether all the members of an iterable satisfy the specified test.\n *\n * @param predicate A function that accepts up to three arguments. The every method calls\n * the predicate function for each element in the iterable until the predicate returns a value\n * which is coercible to the Boolean value false, or until the end of the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the predicate function.\n * If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableEvery<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): boolean;\n\nexport function iterableEvery<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg: any = undefined\n): boolean {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (!boundPredicate(value, index++, iterable)) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";AAkCO,SAAS,cACd,UACA,WAEA,UAAe,QACN;AACT,MAAI,QAAQ;AAEZ,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,IAAI,UAAU,GAAG,SAAS,oBAAoB;AAAA,EACtD;AAEA,QAAM,iBAAiB,UAAU,KAAK,OAAO;AAE7C,aAAW,SAAS,UAAU;AAC5B,QAAI,CAAC,eAAe,OAAO,SAAS,QAAQ,GAAG;AAC7C,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,19 @@
1
+ // src/iterableSome.ts
2
+ function iterableSome(iterable, predicate, thisArg = void 0) {
3
+ let index = 0;
4
+ if (typeof predicate !== "function") {
5
+ throw new TypeError(`${predicate} is not a function`);
6
+ }
7
+ const boundPredicate = predicate.bind(thisArg);
8
+ for (const value of iterable) {
9
+ if (boundPredicate(value, index++, iterable)) {
10
+ return true;
11
+ }
12
+ }
13
+ return false;
14
+ }
15
+
16
+ export {
17
+ iterableSome
18
+ };
19
+ //# sourceMappingURL=chunk-6C3P4TNK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableSome.ts"],"sourcesContent":["/**\n * Determines whether the specified callback function returns true for any element of an iterable.\n *\n * @param predicate\n * A function that accepts up to three arguments. The some method calls the predicate function for each element in the iterable until the predicate returns a value which is coercible to the Boolean value true, or until the end of the iterable.\n *\n * @param thisArg\n * An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableSome<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, iterable: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg: any = undefined\n): boolean {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index++, iterable)) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":";AASO,SAAS,aACd,UACA,WAEA,UAAe,QACN;AACT,MAAI,QAAQ;AAEZ,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,IAAI,UAAU,GAAG,SAAS,oBAAoB;AAAA,EACtD;AAEA,QAAM,iBAAiB,UAAU,KAAK,OAAO;AAE7C,aAAW,SAAS,UAAU;AAC5B,QAAI,eAAe,OAAO,SAAS,QAAQ,GAAG;AAC5C,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -1,6 +1,5 @@
1
- // src/readableStreamValues.ts
2
- function readableStreamValues(readable) {
3
- const reader = readable.getReader();
1
+ // src/readerValues.ts
2
+ function readerValues(reader) {
4
3
  const iterable = {
5
4
  [Symbol.asyncIterator]() {
6
5
  return iterable;
@@ -13,7 +12,7 @@ function readableStreamValues(readable) {
13
12
  return { value: result.value };
14
13
  },
15
14
  async return() {
16
- reader.releaseLock();
15
+ reader.cancel();
17
16
  return { done: true, value: void 0 };
18
17
  }
19
18
  };
@@ -21,6 +20,6 @@ function readableStreamValues(readable) {
21
20
  }
22
21
 
23
22
  export {
24
- readableStreamValues
23
+ readerValues
25
24
  };
26
- //# sourceMappingURL=chunk-RVIERPEV.mjs.map
25
+ //# sourceMappingURL=chunk-EUVK4YM7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/readerValues.ts"],"sourcesContent":["export function readerValues<T>(reader: ReadableStreamDefaultReader<T>): AsyncIterableIterator<T> {\n const iterable: AsyncIterableIterator<T> = {\n [Symbol.asyncIterator]() {\n return iterable;\n },\n async next(): Promise<IteratorResult<T>> {\n const result = await Promise.race([reader.read(), reader.closed]);\n\n if (!result || result.done) {\n return { done: true, value: undefined };\n }\n\n return { value: result.value };\n },\n async return() {\n // Throw inside for-loop is return().\n reader.cancel();\n\n return { done: true, value: undefined };\n }\n };\n\n return iterable;\n}\n"],"mappings":";AAAO,SAAS,aAAgB,QAAkE;AAChG,QAAM,WAAqC;AAAA,IACzC,CAAC,OAAO,aAAa,IAAI;AACvB,aAAO;AAAA,IACT;AAAA,IACA,MAAM,OAAmC;AACvC,YAAM,SAAS,MAAM,QAAQ,KAAK,CAAC,OAAO,KAAK,GAAG,OAAO,MAAM,CAAC;AAEhE,UAAI,CAAC,UAAU,OAAO,MAAM;AAC1B,eAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,MACxC;AAEA,aAAO,EAAE,OAAO,OAAO,MAAM;AAAA,IAC/B;AAAA,IACA,MAAM,SAAS;AAEb,aAAO,OAAO;AAEd,aAAO,EAAE,MAAM,MAAM,OAAO,OAAU;AAAA,IACxC;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,15 @@
1
+ // src/iterableMap.ts
2
+ function* iterableMap(iterable, callbackfn, thisArg) {
3
+ let index = 0;
4
+ if (typeof callbackfn !== "function") {
5
+ throw new TypeError(`${callbackfn} is not a function`);
6
+ }
7
+ for (const value of iterable) {
8
+ yield callbackfn.call(thisArg, value, index++, iterable);
9
+ }
10
+ }
11
+
12
+ export {
13
+ iterableMap
14
+ };
15
+ //# sourceMappingURL=chunk-EZC33HE6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableMap.ts"],"sourcesContent":["/**\n * Calls a defined callback function on each element of an array, and returns an array that contains the results.\n * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function* iterableMap<T, U>(\n iterable: Iterable<T>,\n callbackfn: (value: T, index: number, array: Iterable<T>) => U,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): IterableIterator<U> {\n let index = 0;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n for (const value of iterable) {\n yield callbackfn.call(thisArg, value, index++, iterable);\n }\n}\n"],"mappings":";AAKO,UAAU,YACf,UACA,YAEA,SACqB;AACrB,MAAI,QAAQ;AAEZ,MAAI,OAAO,eAAe,YAAY;AACpC,UAAM,IAAI,UAAU,GAAG,UAAU,oBAAoB;AAAA,EACvD;AAEA,aAAW,SAAS,UAAU;AAC5B,UAAM,WAAW,KAAK,SAAS,OAAO,SAAS,QAAQ;AAAA,EACzD;AACF;","names":[]}
@@ -0,0 +1,16 @@
1
+ // src/iterableConcat.ts
2
+ function* iterableConcat(iterable, ...items) {
3
+ yield* iterable;
4
+ for (const item of items) {
5
+ if (item && typeof item === "object" && Symbol.iterator in item) {
6
+ yield* item;
7
+ } else {
8
+ yield item;
9
+ }
10
+ }
11
+ }
12
+
13
+ export {
14
+ iterableConcat
15
+ };
16
+ //# sourceMappingURL=chunk-GWZF5BB7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableConcat.ts"],"sourcesContent":["/**\n * Combines two or more iterables.\n * This method returns a new iterable without modifying any existing iterables.\n *\n * @param items Additional iterables and/or items to add to the end of the iterable.\n */\nexport function iterableConcat<T>(iterable: Iterable<T>, ...items: Iterable<T>[]): IterableIterator<T>;\n\n/**\n * Combines two or more iterables.\n * This method returns a new iterable without modifying any existing iterables.\n *\n * @param items Additional iterables and/or items to add to the end of the iterable.\n */\nexport function iterableConcat<T>(iterable: Iterable<T>, ...items: (T | Iterable<T>)[]): IterableIterator<T>;\n\nexport function* iterableConcat<T>(iterable: Iterable<T>, ...items: (T | Iterable<T>)[]): IterableIterator<T> {\n yield* iterable;\n\n for (const item of items) {\n if (item && typeof item === 'object' && Symbol.iterator in item) {\n yield* item;\n } else {\n yield item;\n }\n }\n}\n"],"mappings":";AAgBO,UAAU,eAAkB,aAA0B,OAAiD;AAC5G,SAAO;AAEP,aAAW,QAAQ,OAAO;AACxB,QAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,YAAY,MAAM;AAC/D,aAAO;AAAA,IACT,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,20 @@
1
+ // src/iterableFindIndex.ts
2
+ function iterableFindIndex(iterable, predicate, thisArg) {
3
+ let index = 0;
4
+ if (typeof predicate !== "function") {
5
+ throw new TypeError(`${predicate} is not a function`);
6
+ }
7
+ const boundPredicate = predicate.bind(thisArg);
8
+ for (const value of iterable) {
9
+ if (boundPredicate(value, index, iterable)) {
10
+ return index;
11
+ }
12
+ index++;
13
+ }
14
+ return -1;
15
+ }
16
+
17
+ export {
18
+ iterableFindIndex
19
+ };
20
+ //# sourceMappingURL=chunk-HYU4EN7J.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableFindIndex.ts"],"sourcesContent":["/**\n * Returns the index of the first element in the iterable where predicate is true, and -1\n * otherwise.\n *\n * @param predicate find calls predicate once for each element of the iterable, in ascending\n * order, until it finds one where predicate returns true. If such an element is found,\n * findIndex immediately returns that element index. Otherwise, findIndex returns -1.\n *\n * @param thisArg If provided, it will be used as the this value for each invocation of\n * predicate. If it is not provided, undefined is used instead.\n */\nexport function iterableFindIndex<T>(\n iterable: Iterable<T>,\n predicate: (value: T, index: number, obj: Iterable<T>) => unknown,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): number {\n let index = 0;\n\n if (typeof predicate !== 'function') {\n throw new TypeError(`${predicate} is not a function`);\n }\n\n const boundPredicate = predicate.bind(thisArg);\n\n for (const value of iterable) {\n if (boundPredicate(value, index, iterable)) {\n return index;\n }\n\n index++;\n }\n\n return -1;\n}\n"],"mappings":";AAWO,SAAS,kBACd,UACA,WAEA,SACQ;AACR,MAAI,QAAQ;AAEZ,MAAI,OAAO,cAAc,YAAY;AACnC,UAAM,IAAI,UAAU,GAAG,SAAS,oBAAoB;AAAA,EACtD;AAEA,QAAM,iBAAiB,UAAU,KAAK,OAAO;AAE7C,aAAW,SAAS,UAAU;AAC5B,QAAI,eAAe,OAAO,OAAO,QAAQ,GAAG;AAC1C,aAAO;AAAA,IACT;AAEA;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -0,0 +1,16 @@
1
+ // src/iterableForEach.ts
2
+ function iterableForEach(iterable, callbackfn, thisArg) {
3
+ let index = 0;
4
+ if (typeof callbackfn !== "function") {
5
+ throw new TypeError(`${callbackfn} is not a function`);
6
+ }
7
+ const boundCallbackfn = callbackfn.bind(thisArg);
8
+ for (const value of iterable) {
9
+ boundCallbackfn(value, index++, iterable);
10
+ }
11
+ }
12
+
13
+ export {
14
+ iterableForEach
15
+ };
16
+ //# sourceMappingURL=chunk-JU353VSE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableForEach.ts"],"sourcesContent":["/**\n * Performs the specified action for each element in an iterable.\n *\n * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the iterable.\n *\n * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.\n */\nexport function iterableForEach<T>(\n iterable: Iterable<T>,\n callbackfn: (value: T, index: number, iterable: Iterable<T>) => void,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n thisArg?: any\n): void {\n let index = 0;\n\n if (typeof callbackfn !== 'function') {\n throw new TypeError(`${callbackfn} is not a function`);\n }\n\n const boundCallbackfn = callbackfn.bind(thisArg);\n\n for (const value of iterable) {\n boundCallbackfn(value, index++, iterable);\n }\n}\n"],"mappings":";AAOO,SAAS,gBACd,UACA,YAEA,SACM;AACN,MAAI,QAAQ;AAEZ,MAAI,OAAO,eAAe,YAAY;AACpC,UAAM,IAAI,UAAU,GAAG,UAAU,oBAAoB;AAAA,EACvD;AAEA,QAAM,kBAAkB,WAAW,KAAK,OAAO;AAE/C,aAAW,SAAS,UAAU;AAC5B,oBAAgB,OAAO,SAAS,QAAQ;AAAA,EAC1C;AACF;","names":[]}
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  toIntegerOrInfinity
3
3
  } from "./chunk-W5NEOEVE.mjs";
4
- import {
5
- iteratorToIterable
6
- } from "./chunk-MNDAEMYM.mjs";
7
4
 
8
- // src/iteratorSlice.ts
9
- function* iteratorSlice(iterator, start = 0, end = Infinity) {
5
+ // src/iterableSlice.ts
6
+ function* iterableSlice(iterable, start = 0, end = Infinity) {
10
7
  let index = 0;
11
8
  start = toIntegerOrInfinity(start);
12
9
  start = start === -Infinity ? 0 : start;
@@ -21,7 +18,7 @@ function* iteratorSlice(iterator, start = 0, end = Infinity) {
21
18
  if (start === Infinity) {
22
19
  return;
23
20
  }
24
- for (const item of iteratorToIterable(iterator)) {
21
+ for (const item of iterable) {
25
22
  if (index >= start && index < end) {
26
23
  yield item;
27
24
  }
@@ -33,6 +30,6 @@ function* iteratorSlice(iterator, start = 0, end = Infinity) {
33
30
  }
34
31
 
35
32
  export {
36
- iteratorSlice
33
+ iterableSlice
37
34
  };
38
- //# sourceMappingURL=chunk-EQZQP6GW.mjs.map
35
+ //# sourceMappingURL=chunk-KONB7TV6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableSlice.ts"],"sourcesContent":["import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns a copy of a section of an iterable.\n * For both start and end, a negative index can be used to indicate an offset from the end of the iterable.\n * For example, -2 refers to the second to last element of the iterable.\n *\n * @param start The beginning index of the specified portion of the iterable.\n * If start is undefined, then the slice begins at index 0.\n *\n * @param end The end index of the specified portion of the iterable. This is exclusive of the element at the index 'end'.\n * If end is undefined, then the slice extends to the end of the iterable.\n */\nexport function* iterableSlice<T>(iterable: Iterable<T>, start: number = 0, end: number = Infinity): Iterable<T> {\n let index = 0;\n\n start = toIntegerOrInfinity(start);\n start = start === -Infinity ? 0 : start;\n end = toIntegerOrInfinity(end);\n end = end === -Infinity ? 0 : end;\n\n if (start < 0) {\n throw new TypeError('start cannot be a negative finite number');\n }\n\n if (end < 0) {\n throw new TypeError('end cannot be a negative finite number');\n }\n\n if (start === Infinity) {\n return;\n }\n\n for (const item of iterable) {\n if (index >= start && index < end) {\n yield item;\n }\n\n index++;\n\n if (index > end) {\n break;\n }\n }\n}\n"],"mappings":";;;;;AAaO,UAAU,cAAiB,UAAuB,QAAgB,GAAG,MAAc,UAAuB;AAC/G,MAAI,QAAQ;AAEZ,UAAQ,oBAAoB,KAAK;AACjC,UAAQ,UAAU,YAAY,IAAI;AAClC,QAAM,oBAAoB,GAAG;AAC7B,QAAM,QAAQ,YAAY,IAAI;AAE9B,MAAI,QAAQ,GAAG;AACb,UAAM,IAAI,UAAU,0CAA0C;AAAA,EAChE;AAEA,MAAI,MAAM,GAAG;AACX,UAAM,IAAI,UAAU,wCAAwC;AAAA,EAC9D;AAEA,MAAI,UAAU,UAAU;AACtB;AAAA,EACF;AAEA,aAAW,QAAQ,UAAU;AAC3B,QAAI,SAAS,SAAS,QAAQ,KAAK;AACjC,YAAM;AAAA,IACR;AAEA;AAEA,QAAI,QAAQ,KAAK;AACf;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  toIntegerOrInfinity
3
3
  } from "./chunk-W5NEOEVE.mjs";
4
- import {
5
- iteratorToIterable
6
- } from "./chunk-MNDAEMYM.mjs";
7
4
 
8
- // src/iteratorAt.ts
9
- function iteratorAt(iterator, index) {
5
+ // src/iterableAt.ts
6
+ function iterableAt(iterable, index) {
10
7
  let currentIndex = 0;
11
8
  index = toIntegerOrInfinity(index);
12
9
  if (!isFinite(index)) {
@@ -15,7 +12,7 @@ function iteratorAt(iterator, index) {
15
12
  if (index < 0) {
16
13
  throw new TypeError("index cannot be a negative finite number");
17
14
  }
18
- for (const value of iteratorToIterable(iterator)) {
15
+ for (const value of iterable) {
19
16
  if (currentIndex++ === index) {
20
17
  return value;
21
18
  }
@@ -24,6 +21,6 @@ function iteratorAt(iterator, index) {
24
21
  }
25
22
 
26
23
  export {
27
- iteratorAt
24
+ iterableAt
28
25
  };
29
- //# sourceMappingURL=chunk-H5ARVU55.mjs.map
26
+ //# sourceMappingURL=chunk-MDBK7ND5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/iterableAt.ts"],"sourcesContent":["import toIntegerOrInfinity from './private/toIntegerOrInfinity';\n\n/**\n * Returns the item located at the specified index.\n *\n * @param index The zero-based index of the desired code unit. A negative index will count back from the last item.\n */\nexport function iterableAt<T>(iterable: Iterable<T>, index: number): T | undefined {\n let currentIndex = 0;\n\n index = toIntegerOrInfinity(index);\n\n if (!isFinite(index)) {\n return;\n }\n\n if (index < 0) {\n throw new TypeError('index cannot be a negative finite number');\n }\n\n for (const value of iterable) {\n if (currentIndex++ === index) {\n return value;\n }\n }\n\n return undefined;\n}\n"],"mappings":";;;;;AAOO,SAAS,WAAc,UAAuB,OAA8B;AACjF,MAAI,eAAe;AAEnB,UAAQ,oBAAoB,KAAK;AAEjC,MAAI,CAAC,SAAS,KAAK,GAAG;AACpB;AAAA,EACF;AAEA,MAAI,QAAQ,GAAG;AACb,UAAM,IAAI,UAAU,0CAA0C;AAAA,EAChE;AAEA,aAAW,SAAS,UAAU;AAC5B,QAAI,mBAAmB,OAAO;AAC5B,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}