@sapphire/iterator-utilities 1.0.3-next.fc35dd86 → 2.0.0-next.09afdaab

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 (351) hide show
  1. package/dist/cjs/index.cjs +217 -0
  2. package/dist/cjs/index.d.cts +32 -9
  3. package/dist/cjs/lib/all.cjs +12 -0
  4. package/dist/cjs/lib/all.cjs.map +1 -0
  5. package/dist/cjs/lib/all.d.cts +2 -0
  6. package/dist/cjs/lib/any.cjs +12 -0
  7. package/dist/cjs/lib/any.cjs.map +1 -0
  8. package/dist/cjs/lib/any.d.cts +2 -0
  9. package/dist/cjs/lib/append.cjs.map +1 -1
  10. package/dist/cjs/lib/at.cjs.map +1 -1
  11. package/dist/cjs/lib/average.cjs.map +1 -1
  12. package/dist/cjs/lib/chain.cjs.map +1 -1
  13. package/dist/cjs/lib/chunk.cjs.map +1 -1
  14. package/dist/cjs/lib/collect.cjs +12 -0
  15. package/dist/cjs/lib/collect.cjs.map +1 -0
  16. package/dist/cjs/lib/collect.d.cts +2 -0
  17. package/dist/cjs/lib/collectInto.cjs +17 -0
  18. package/dist/cjs/lib/collectInto.cjs.map +1 -0
  19. package/dist/cjs/lib/collectInto.d.cts +29 -0
  20. package/dist/cjs/lib/compact.cjs.map +1 -1
  21. package/dist/cjs/lib/compare.cjs +15 -0
  22. package/dist/cjs/lib/compare.cjs.map +1 -0
  23. package/dist/cjs/lib/compare.d.cts +32 -0
  24. package/dist/cjs/lib/compareBy.cjs +26 -0
  25. package/dist/cjs/lib/compareBy.cjs.map +1 -0
  26. package/dist/cjs/lib/compareBy.d.cts +31 -0
  27. package/dist/cjs/lib/compress.cjs.map +1 -1
  28. package/dist/cjs/lib/contains.cjs.map +1 -1
  29. package/dist/cjs/lib/count.cjs.map +1 -1
  30. package/dist/cjs/lib/cycle.cjs.map +1 -1
  31. package/dist/cjs/lib/difference.cjs.map +1 -1
  32. package/dist/cjs/lib/drop.cjs +0 -1
  33. package/dist/cjs/lib/drop.cjs.map +1 -1
  34. package/dist/cjs/lib/drop.d.cts +1 -1
  35. package/dist/cjs/lib/dropLast.cjs +0 -1
  36. package/dist/cjs/lib/dropLast.cjs.map +1 -1
  37. package/dist/cjs/lib/dropLast.d.cts +1 -1
  38. package/dist/cjs/lib/dropWhile.cjs +0 -1
  39. package/dist/cjs/lib/dropWhile.cjs.map +1 -1
  40. package/dist/cjs/lib/dropWhile.d.cts +1 -1
  41. package/dist/cjs/lib/empty.cjs.map +1 -1
  42. package/dist/cjs/lib/enumerate.cjs.map +1 -1
  43. package/dist/cjs/lib/equal.cjs +15 -0
  44. package/dist/cjs/lib/equal.cjs.map +1 -0
  45. package/dist/cjs/lib/equal.d.cts +26 -0
  46. package/dist/cjs/lib/equalBy.cjs +23 -0
  47. package/dist/cjs/lib/equalBy.cjs.map +1 -0
  48. package/dist/cjs/lib/equalBy.d.cts +27 -0
  49. package/dist/cjs/lib/every.cjs.map +1 -1
  50. package/dist/cjs/lib/filter.cjs +0 -1
  51. package/dist/cjs/lib/filter.cjs.map +1 -1
  52. package/dist/cjs/lib/filter.d.cts +1 -1
  53. package/dist/cjs/lib/find.cjs.map +1 -1
  54. package/dist/cjs/lib/findIndex.cjs.map +1 -1
  55. package/dist/cjs/lib/first.cjs.map +1 -1
  56. package/dist/cjs/lib/flat.cjs.map +1 -1
  57. package/dist/cjs/lib/flatMap.cjs.map +1 -1
  58. package/dist/cjs/lib/forEach.cjs.map +1 -1
  59. package/dist/cjs/lib/from.cjs.map +1 -1
  60. package/dist/cjs/lib/fuse.cjs +26 -0
  61. package/dist/cjs/lib/fuse.cjs.map +1 -0
  62. package/dist/cjs/lib/fuse.d.cts +47 -0
  63. package/dist/cjs/lib/greaterOrEqualThan.cjs +17 -0
  64. package/dist/cjs/lib/greaterOrEqualThan.cjs.map +1 -0
  65. package/dist/cjs/lib/greaterOrEqualThan.d.cts +32 -0
  66. package/dist/cjs/lib/greaterThan.cjs +17 -0
  67. package/dist/cjs/lib/greaterThan.cjs.map +1 -0
  68. package/dist/cjs/lib/greaterThan.d.cts +32 -0
  69. package/dist/cjs/lib/indexOf.cjs +0 -1
  70. package/dist/cjs/lib/indexOf.cjs.map +1 -1
  71. package/dist/cjs/lib/indexOf.d.cts +1 -1
  72. package/dist/cjs/lib/inspect.cjs +25 -0
  73. package/dist/cjs/lib/inspect.cjs.map +1 -0
  74. package/dist/cjs/lib/inspect.d.cts +39 -0
  75. package/dist/cjs/lib/intersect.cjs.map +1 -1
  76. package/dist/cjs/lib/intersperse.cjs +35 -0
  77. package/dist/cjs/lib/intersperse.cjs.map +1 -0
  78. package/dist/cjs/lib/intersperse.d.cts +30 -0
  79. package/dist/cjs/lib/isEmpty.cjs.map +1 -1
  80. package/dist/cjs/lib/isSorted.cjs +15 -0
  81. package/dist/cjs/lib/isSorted.cjs.map +1 -0
  82. package/dist/cjs/lib/isSorted.d.cts +35 -0
  83. package/dist/cjs/lib/isSortedBy.cjs +26 -0
  84. package/dist/cjs/lib/isSortedBy.cjs.map +1 -0
  85. package/dist/cjs/lib/isSortedBy.d.cts +32 -0
  86. package/dist/cjs/lib/isSortedByKey.cjs +29 -0
  87. package/dist/cjs/lib/isSortedByKey.cjs.map +1 -0
  88. package/dist/cjs/lib/isSortedByKey.d.cts +30 -0
  89. package/dist/cjs/lib/last.cjs.map +1 -1
  90. package/dist/cjs/lib/lessOrEqualThan.cjs +17 -0
  91. package/dist/cjs/lib/lessOrEqualThan.cjs.map +1 -0
  92. package/dist/cjs/lib/lessOrEqualThan.d.cts +32 -0
  93. package/dist/cjs/lib/lessThan.cjs +17 -0
  94. package/dist/cjs/lib/lessThan.cjs.map +1 -0
  95. package/dist/cjs/lib/lessThan.d.cts +32 -0
  96. package/dist/cjs/lib/map.cjs.map +1 -1
  97. package/dist/cjs/lib/max.cjs +3 -7
  98. package/dist/cjs/lib/max.cjs.map +1 -1
  99. package/dist/cjs/lib/max.d.cts +8 -3
  100. package/dist/cjs/lib/maxBy.cjs +27 -0
  101. package/dist/cjs/lib/maxBy.cjs.map +1 -0
  102. package/dist/cjs/lib/maxBy.d.cts +31 -0
  103. package/dist/cjs/lib/maxByKey.cjs +32 -0
  104. package/dist/cjs/lib/maxByKey.cjs.map +1 -0
  105. package/dist/cjs/lib/maxByKey.d.cts +32 -0
  106. package/dist/cjs/lib/min.cjs +3 -7
  107. package/dist/cjs/lib/min.cjs.map +1 -1
  108. package/dist/cjs/lib/min.d.cts +8 -3
  109. package/dist/cjs/lib/minBy.cjs +27 -0
  110. package/dist/cjs/lib/minBy.cjs.map +1 -0
  111. package/dist/cjs/lib/minBy.d.cts +31 -0
  112. package/dist/cjs/lib/minByKey.cjs +32 -0
  113. package/dist/cjs/lib/minByKey.cjs.map +1 -0
  114. package/dist/cjs/lib/minByKey.d.cts +31 -0
  115. package/dist/cjs/lib/notEqual.cjs +15 -0
  116. package/dist/cjs/lib/notEqual.cjs.map +1 -0
  117. package/dist/cjs/lib/notEqual.d.cts +26 -0
  118. package/dist/cjs/lib/nth.cjs +12 -0
  119. package/dist/cjs/lib/nth.cjs.map +1 -0
  120. package/dist/cjs/lib/nth.d.cts +2 -0
  121. package/dist/cjs/lib/partition.cjs.map +1 -1
  122. package/dist/cjs/lib/peekable.cjs.map +1 -1
  123. package/dist/cjs/lib/position.cjs +12 -0
  124. package/dist/cjs/lib/position.cjs.map +1 -0
  125. package/dist/cjs/lib/position.d.cts +2 -0
  126. package/dist/cjs/lib/prepend.cjs.map +1 -1
  127. package/dist/cjs/lib/product.cjs.map +1 -1
  128. package/dist/cjs/lib/range.cjs.map +1 -1
  129. package/dist/cjs/lib/reduce.cjs.map +1 -1
  130. package/dist/cjs/lib/repeat.cjs.map +1 -1
  131. package/dist/cjs/lib/reverse.cjs +2 -5
  132. package/dist/cjs/lib/reverse.cjs.map +1 -1
  133. package/dist/cjs/lib/shared/_assertFunction.cjs.map +1 -1
  134. package/dist/cjs/lib/shared/_assertNotNegative.cjs.map +1 -1
  135. package/dist/cjs/lib/shared/_assertPositive.cjs.map +1 -1
  136. package/dist/cjs/lib/shared/_compare.cjs +36 -0
  137. package/dist/cjs/lib/shared/_compare.cjs.map +1 -0
  138. package/dist/cjs/lib/shared/_compare.d.cts +20 -0
  139. package/dist/cjs/lib/shared/_makeIterableIterator.cjs.map +1 -1
  140. package/dist/cjs/lib/shared/_toIntegerOrInfinityOrThrow.cjs.map +1 -1
  141. package/dist/cjs/lib/shared/_toIntegerOrThrow.cjs.map +1 -1
  142. package/dist/cjs/lib/shared/_toNumberOrThrow.cjs.map +1 -1
  143. package/dist/cjs/lib/shared/comparators.cjs +28 -0
  144. package/dist/cjs/lib/shared/comparators.cjs.map +1 -0
  145. package/dist/cjs/lib/shared/comparators.d.cts +34 -0
  146. package/dist/cjs/lib/skip.cjs +12 -0
  147. package/dist/cjs/lib/skip.cjs.map +1 -0
  148. package/dist/cjs/lib/skip.d.cts +2 -0
  149. package/dist/cjs/lib/skipLast.cjs +12 -0
  150. package/dist/cjs/lib/skipLast.cjs.map +1 -0
  151. package/dist/cjs/lib/skipLast.d.cts +2 -0
  152. package/dist/cjs/lib/skipWhile.cjs +12 -0
  153. package/dist/cjs/lib/skipWhile.cjs.map +1 -0
  154. package/dist/cjs/lib/skipWhile.d.cts +2 -0
  155. package/dist/cjs/lib/slice.cjs.map +1 -1
  156. package/dist/cjs/lib/some.cjs.map +1 -1
  157. package/dist/cjs/lib/sorted.cjs.map +1 -1
  158. package/dist/cjs/lib/starMap.cjs.map +1 -1
  159. package/dist/cjs/lib/stepBy.cjs +29 -0
  160. package/dist/cjs/lib/stepBy.cjs.map +1 -0
  161. package/dist/cjs/lib/stepBy.d.cts +24 -0
  162. package/dist/cjs/lib/sum.cjs.map +1 -1
  163. package/dist/cjs/lib/take.cjs.map +1 -1
  164. package/dist/cjs/lib/takeLast.cjs.map +1 -1
  165. package/dist/cjs/lib/takeWhile.cjs +12 -0
  166. package/dist/cjs/lib/takeWhile.cjs.map +1 -0
  167. package/dist/cjs/lib/takeWhile.d.cts +2 -0
  168. package/dist/cjs/lib/tee.cjs.map +1 -1
  169. package/dist/cjs/lib/toArray.cjs.map +1 -1
  170. package/dist/cjs/lib/toIterableIterator.cjs.map +1 -1
  171. package/dist/cjs/lib/union.cjs.map +1 -1
  172. package/dist/cjs/lib/unique.cjs.map +1 -1
  173. package/dist/cjs/lib/unzip.cjs.map +1 -1
  174. package/dist/cjs/lib/zip.cjs.map +1 -1
  175. package/dist/esm/index.d.mts +32 -9
  176. package/dist/esm/index.mjs +31 -0
  177. package/dist/esm/lib/all.d.mts +2 -0
  178. package/dist/esm/lib/all.mjs +4 -0
  179. package/dist/esm/lib/all.mjs.map +1 -0
  180. package/dist/esm/lib/any.d.mts +2 -0
  181. package/dist/esm/lib/any.mjs +4 -0
  182. package/dist/esm/lib/any.mjs.map +1 -0
  183. package/dist/esm/lib/append.mjs.map +1 -1
  184. package/dist/esm/lib/at.mjs.map +1 -1
  185. package/dist/esm/lib/average.mjs.map +1 -1
  186. package/dist/esm/lib/chain.mjs.map +1 -1
  187. package/dist/esm/lib/chunk.mjs.map +1 -1
  188. package/dist/esm/lib/collect.d.mts +2 -0
  189. package/dist/esm/lib/collect.mjs +4 -0
  190. package/dist/esm/lib/collect.mjs.map +1 -0
  191. package/dist/esm/lib/collectInto.d.mts +29 -0
  192. package/dist/esm/lib/collectInto.mjs +14 -0
  193. package/dist/esm/lib/collectInto.mjs.map +1 -0
  194. package/dist/esm/lib/compact.mjs.map +1 -1
  195. package/dist/esm/lib/compare.d.mts +32 -0
  196. package/dist/esm/lib/compare.mjs +12 -0
  197. package/dist/esm/lib/compare.mjs.map +1 -0
  198. package/dist/esm/lib/compareBy.d.mts +31 -0
  199. package/dist/esm/lib/compareBy.mjs +23 -0
  200. package/dist/esm/lib/compareBy.mjs.map +1 -0
  201. package/dist/esm/lib/compress.mjs.map +1 -1
  202. package/dist/esm/lib/contains.mjs.map +1 -1
  203. package/dist/esm/lib/count.mjs.map +1 -1
  204. package/dist/esm/lib/cycle.mjs.map +1 -1
  205. package/dist/esm/lib/difference.mjs.map +1 -1
  206. package/dist/esm/lib/drop.d.mts +1 -1
  207. package/dist/esm/lib/drop.mjs +1 -1
  208. package/dist/esm/lib/drop.mjs.map +1 -1
  209. package/dist/esm/lib/dropLast.d.mts +1 -1
  210. package/dist/esm/lib/dropLast.mjs +1 -1
  211. package/dist/esm/lib/dropLast.mjs.map +1 -1
  212. package/dist/esm/lib/dropWhile.d.mts +1 -1
  213. package/dist/esm/lib/dropWhile.mjs +1 -1
  214. package/dist/esm/lib/dropWhile.mjs.map +1 -1
  215. package/dist/esm/lib/empty.mjs.map +1 -1
  216. package/dist/esm/lib/enumerate.mjs.map +1 -1
  217. package/dist/esm/lib/equal.d.mts +26 -0
  218. package/dist/esm/lib/equal.mjs +11 -0
  219. package/dist/esm/lib/equal.mjs.map +1 -0
  220. package/dist/esm/lib/equalBy.d.mts +27 -0
  221. package/dist/esm/lib/equalBy.mjs +19 -0
  222. package/dist/esm/lib/equalBy.mjs.map +1 -0
  223. package/dist/esm/lib/every.mjs.map +1 -1
  224. package/dist/esm/lib/filter.d.mts +1 -1
  225. package/dist/esm/lib/filter.mjs +1 -1
  226. package/dist/esm/lib/filter.mjs.map +1 -1
  227. package/dist/esm/lib/find.mjs.map +1 -1
  228. package/dist/esm/lib/findIndex.mjs.map +1 -1
  229. package/dist/esm/lib/first.mjs.map +1 -1
  230. package/dist/esm/lib/flat.mjs.map +1 -1
  231. package/dist/esm/lib/flatMap.mjs.map +1 -1
  232. package/dist/esm/lib/forEach.mjs.map +1 -1
  233. package/dist/esm/lib/from.mjs.map +1 -1
  234. package/dist/esm/lib/fuse.d.mts +47 -0
  235. package/dist/esm/lib/fuse.mjs +23 -0
  236. package/dist/esm/lib/fuse.mjs.map +1 -0
  237. package/dist/esm/lib/greaterOrEqualThan.d.mts +32 -0
  238. package/dist/esm/lib/greaterOrEqualThan.mjs +13 -0
  239. package/dist/esm/lib/greaterOrEqualThan.mjs.map +1 -0
  240. package/dist/esm/lib/greaterThan.d.mts +32 -0
  241. package/dist/esm/lib/greaterThan.mjs +13 -0
  242. package/dist/esm/lib/greaterThan.mjs.map +1 -0
  243. package/dist/esm/lib/indexOf.d.mts +1 -1
  244. package/dist/esm/lib/indexOf.mjs +1 -1
  245. package/dist/esm/lib/indexOf.mjs.map +1 -1
  246. package/dist/esm/lib/inspect.d.mts +39 -0
  247. package/dist/esm/lib/inspect.mjs +22 -0
  248. package/dist/esm/lib/inspect.mjs.map +1 -0
  249. package/dist/esm/lib/intersect.mjs.map +1 -1
  250. package/dist/esm/lib/intersperse.d.mts +30 -0
  251. package/dist/esm/lib/intersperse.mjs +32 -0
  252. package/dist/esm/lib/intersperse.mjs.map +1 -0
  253. package/dist/esm/lib/isEmpty.mjs.map +1 -1
  254. package/dist/esm/lib/isSorted.d.mts +35 -0
  255. package/dist/esm/lib/isSorted.mjs +12 -0
  256. package/dist/esm/lib/isSorted.mjs.map +1 -0
  257. package/dist/esm/lib/isSortedBy.d.mts +32 -0
  258. package/dist/esm/lib/isSortedBy.mjs +23 -0
  259. package/dist/esm/lib/isSortedBy.mjs.map +1 -0
  260. package/dist/esm/lib/isSortedByKey.d.mts +30 -0
  261. package/dist/esm/lib/isSortedByKey.mjs +26 -0
  262. package/dist/esm/lib/isSortedByKey.mjs.map +1 -0
  263. package/dist/esm/lib/last.mjs.map +1 -1
  264. package/dist/esm/lib/lessOrEqualThan.d.mts +32 -0
  265. package/dist/esm/lib/lessOrEqualThan.mjs +13 -0
  266. package/dist/esm/lib/lessOrEqualThan.mjs.map +1 -0
  267. package/dist/esm/lib/lessThan.d.mts +32 -0
  268. package/dist/esm/lib/lessThan.mjs +13 -0
  269. package/dist/esm/lib/lessThan.mjs.map +1 -0
  270. package/dist/esm/lib/map.mjs.map +1 -1
  271. package/dist/esm/lib/max.d.mts +8 -3
  272. package/dist/esm/lib/max.mjs +3 -7
  273. package/dist/esm/lib/max.mjs.map +1 -1
  274. package/dist/esm/lib/maxBy.d.mts +31 -0
  275. package/dist/esm/lib/maxBy.mjs +24 -0
  276. package/dist/esm/lib/maxBy.mjs.map +1 -0
  277. package/dist/esm/lib/maxByKey.d.mts +32 -0
  278. package/dist/esm/lib/maxByKey.mjs +29 -0
  279. package/dist/esm/lib/maxByKey.mjs.map +1 -0
  280. package/dist/esm/lib/min.d.mts +8 -3
  281. package/dist/esm/lib/min.mjs +3 -7
  282. package/dist/esm/lib/min.mjs.map +1 -1
  283. package/dist/esm/lib/minBy.d.mts +31 -0
  284. package/dist/esm/lib/minBy.mjs +24 -0
  285. package/dist/esm/lib/minBy.mjs.map +1 -0
  286. package/dist/esm/lib/minByKey.d.mts +31 -0
  287. package/dist/esm/lib/minByKey.mjs +29 -0
  288. package/dist/esm/lib/minByKey.mjs.map +1 -0
  289. package/dist/esm/lib/notEqual.d.mts +26 -0
  290. package/dist/esm/lib/notEqual.mjs +11 -0
  291. package/dist/esm/lib/notEqual.mjs.map +1 -0
  292. package/dist/esm/lib/nth.d.mts +2 -0
  293. package/dist/esm/lib/nth.mjs +4 -0
  294. package/dist/esm/lib/nth.mjs.map +1 -0
  295. package/dist/esm/lib/partition.mjs.map +1 -1
  296. package/dist/esm/lib/peekable.mjs.map +1 -1
  297. package/dist/esm/lib/position.d.mts +2 -0
  298. package/dist/esm/lib/position.mjs +4 -0
  299. package/dist/esm/lib/position.mjs.map +1 -0
  300. package/dist/esm/lib/prepend.mjs.map +1 -1
  301. package/dist/esm/lib/product.mjs.map +1 -1
  302. package/dist/esm/lib/range.mjs.map +1 -1
  303. package/dist/esm/lib/reduce.mjs.map +1 -1
  304. package/dist/esm/lib/repeat.mjs.map +1 -1
  305. package/dist/esm/lib/reverse.mjs +2 -5
  306. package/dist/esm/lib/reverse.mjs.map +1 -1
  307. package/dist/esm/lib/shared/_assertFunction.mjs.map +1 -1
  308. package/dist/esm/lib/shared/_assertNotNegative.mjs.map +1 -1
  309. package/dist/esm/lib/shared/_assertPositive.mjs.map +1 -1
  310. package/dist/esm/lib/shared/_compare.d.mts +20 -0
  311. package/dist/esm/lib/shared/_compare.mjs +30 -0
  312. package/dist/esm/lib/shared/_compare.mjs.map +1 -0
  313. package/dist/esm/lib/shared/_makeIterableIterator.mjs.map +1 -1
  314. package/dist/esm/lib/shared/_toIntegerOrInfinityOrThrow.mjs.map +1 -1
  315. package/dist/esm/lib/shared/_toIntegerOrThrow.mjs.map +1 -1
  316. package/dist/esm/lib/shared/_toNumberOrThrow.mjs.map +1 -1
  317. package/dist/esm/lib/shared/comparators.d.mts +34 -0
  318. package/dist/esm/lib/shared/comparators.mjs +21 -0
  319. package/dist/esm/lib/shared/comparators.mjs.map +1 -0
  320. package/dist/esm/lib/skip.d.mts +2 -0
  321. package/dist/esm/lib/skip.mjs +4 -0
  322. package/dist/esm/lib/skip.mjs.map +1 -0
  323. package/dist/esm/lib/skipLast.d.mts +2 -0
  324. package/dist/esm/lib/skipLast.mjs +4 -0
  325. package/dist/esm/lib/skipLast.mjs.map +1 -0
  326. package/dist/esm/lib/skipWhile.d.mts +2 -0
  327. package/dist/esm/lib/skipWhile.mjs +4 -0
  328. package/dist/esm/lib/skipWhile.mjs.map +1 -0
  329. package/dist/esm/lib/slice.mjs.map +1 -1
  330. package/dist/esm/lib/some.mjs.map +1 -1
  331. package/dist/esm/lib/sorted.mjs.map +1 -1
  332. package/dist/esm/lib/starMap.mjs.map +1 -1
  333. package/dist/esm/lib/stepBy.d.mts +24 -0
  334. package/dist/esm/lib/stepBy.mjs +26 -0
  335. package/dist/esm/lib/stepBy.mjs.map +1 -0
  336. package/dist/esm/lib/sum.mjs.map +1 -1
  337. package/dist/esm/lib/take.mjs.map +1 -1
  338. package/dist/esm/lib/takeLast.mjs.map +1 -1
  339. package/dist/esm/lib/takeWhile.d.mts +2 -0
  340. package/dist/esm/lib/takeWhile.mjs +4 -0
  341. package/dist/esm/lib/takeWhile.mjs.map +1 -0
  342. package/dist/esm/lib/tee.mjs.map +1 -1
  343. package/dist/esm/lib/toArray.mjs.map +1 -1
  344. package/dist/esm/lib/toIterableIterator.mjs.map +1 -1
  345. package/dist/esm/lib/union.mjs.map +1 -1
  346. package/dist/esm/lib/unique.mjs.map +1 -1
  347. package/dist/esm/lib/unzip.mjs.map +1 -1
  348. package/dist/esm/lib/zip.mjs.map +1 -1
  349. package/dist/iife/index.global.js +391 -49
  350. package/dist/iife/index.global.js.map +1 -1
  351. package/package.json +295 -25
@@ -0,0 +1,32 @@
1
+ import { IterableResolvable } from './from.cjs';
2
+ import { LexicographicComparison } from './shared/_compare.js';
3
+
4
+ /**
5
+ * {@link LexicographicComparison Lexicographically} compares the elements of both iterators are equal.
6
+ *
7
+ * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.
8
+ * If this is undesirable, use {@link compareBy} instead.
9
+ *
10
+ * @param iterable The iterator to compare.
11
+ * @param other The iterator to compare against.
12
+ * @returns Whether the two iterators are equal.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { compare } from '@sapphire/iterator-utilities';
17
+ *
18
+ * console.log(compare([1], [1]));
19
+ * // Output: 0
20
+ * console.log(compare([1], [1, 2]));
21
+ * // Output: -1
22
+ * console.log(compare([1, 2], [1]));
23
+ * // Output: 1
24
+ * ```
25
+ *
26
+ * @remarks
27
+ *
28
+ * This function consumes the entire iterator.
29
+ */
30
+ declare function compare<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): LexicographicComparison;
31
+
32
+ export { compare };
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var from_cjs = require('./from.cjs');
4
+ var _compare_cjs = require('./shared/_compare.cjs');
5
+ var toIterableIterator_cjs = require('./toIterableIterator.cjs');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ function compareBy(iterable, other, comparator) {
10
+ const iterator1 = from_cjs.from(other);
11
+ for (const x of toIterableIterator_cjs.toIterableIterator(iterable)) {
12
+ const result1 = iterator1.next();
13
+ if (result1.done) return 1;
14
+ const y = result1.value;
15
+ const comparison = _compare_cjs.compareIteratorElements(x, y, comparator);
16
+ if (!_compare_cjs.orderingIsEqual(comparison)) {
17
+ return _compare_cjs.orderingIsLess(comparison) ? -1 : 1;
18
+ }
19
+ }
20
+ return iterator1.next().done ? 0 : -1;
21
+ }
22
+ __name(compareBy, "compareBy");
23
+
24
+ exports.compareBy = compareBy;
25
+ //# sourceMappingURL=compareBy.cjs.map
26
+ //# sourceMappingURL=compareBy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/compareBy.ts"],"names":["from","toIterableIterator","compareIteratorElements","orderingIsEqual","orderingIsLess"],"mappings":";;;;;;;;AA6BO,SAAS,SAAA,CACf,QACA,EAAA,KAAA,EACA,UAC0B,EAAA;AAC1B,EAAM,MAAA,SAAA,GAAYA,cAAK,KAAK,CAAA;AAE5B,EAAW,KAAA,MAAA,CAAA,IAAKC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AAC7C,IAAM,MAAA,OAAA,GAAU,UAAU,IAAK,EAAA;AAC/B,IAAI,IAAA,OAAA,CAAQ,MAAa,OAAA,CAAA;AAEzB,IAAA,MAAM,IAAI,OAAQ,CAAA,KAAA;AAClB,IAAA,MAAM,UAAa,GAAAC,oCAAA,CAAqC,CAAG,EAAA,CAAA,EAAG,UAAU,CAAA;AACxE,IAAI,IAAA,CAACC,4BAAgB,CAAA,UAAU,CAAG,EAAA;AACjC,MAAO,OAAAC,2BAAA,CAAe,UAAU,CAAA,GAAI,CAAK,CAAA,GAAA,CAAA;AAAA;AAC1C;AAGD,EAAA,OAAO,SAAU,CAAA,IAAA,EAAO,CAAA,IAAA,GAAO,CAAI,GAAA,CAAA,CAAA;AACpC;AAnBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"compareBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { compareIteratorElements, orderingIsEqual, orderingIsLess, type CompareByComparator, type LexicographicComparison } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * {@link LexicographicComparison Lexicographically} compares the elements of both iterators are equal. That is:\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { ascNumber, compareBy } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(compareBy(x, y, (x, y) => ascNumber(x, y)));\n * // Output: -1\n * console.log(compareBy(x, y, (x, y) => ascNumber(x * x, y)));\n * // Output: 0\n * console.log(compareBy(x, y, (x, y) => ascNumber(x * 2, y)));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function compareBy<const ElementType>(\n\titerable: IterableResolvable<ElementType | undefined>,\n\tother: IterableResolvable<ElementType | undefined>,\n\tcomparator: CompareByComparator<ElementType>\n): LexicographicComparison {\n\tconst iterator1 = from(other);\n\n\tfor (const x of toIterableIterator(iterable)) {\n\t\tconst result1 = iterator1.next();\n\t\tif (result1.done) return 1;\n\n\t\tconst y = result1.value;\n\t\tconst comparison = compareIteratorElements<ElementType>(x, y, comparator);\n\t\tif (!orderingIsEqual(comparison)) {\n\t\t\treturn orderingIsLess(comparison) ? -1 : 1;\n\t\t}\n\t}\n\n\treturn iterator1.next().done ? 0 : -1;\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import { IterableResolvable } from './from.cjs';
2
+ import { CompareByComparator, LexicographicComparison } from './shared/_compare.js';
3
+
4
+ /**
5
+ * {@link LexicographicComparison Lexicographically} compares the elements of both iterators are equal. That is:
6
+ *
7
+ * @param iterable The iterator to compare.
8
+ * @param other The iterator to compare against.
9
+ * @returns Whether the two iterators are equal.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { ascNumber, compareBy } from '@sapphire/iterator-utilities';
14
+ *
15
+ * const x = [1, 2, 3, 4];
16
+ * const y = [1, 4, 9, 16];
17
+ * console.log(compareBy(x, y, (x, y) => ascNumber(x, y)));
18
+ * // Output: -1
19
+ * console.log(compareBy(x, y, (x, y) => ascNumber(x * x, y)));
20
+ * // Output: 0
21
+ * console.log(compareBy(x, y, (x, y) => ascNumber(x * 2, y)));
22
+ * // Output: 1
23
+ * ```
24
+ *
25
+ * @remarks
26
+ *
27
+ * This function consumes the entire iterator.
28
+ */
29
+ declare function compareBy<const ElementType>(iterable: IterableResolvable<ElementType | undefined>, other: IterableResolvable<ElementType | undefined>, comparator: CompareByComparator<ElementType>): LexicographicComparison;
30
+
31
+ export { compareBy };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/compress.ts"],"names":["from","toIterableIterator"],"mappings":";;;;;;;AAwBO,UAAU,QAAA,CAChB,UACA,SACgC,EAAA;AAChC,EAAM,MAAA,iBAAA,GAAoBA,cAAK,SAAS,CAAA,CAAA;AACxC,EAAW,KAAA,MAAA,sBAAA,IAA0BC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AAClE,IAAM,MAAA,cAAA,GAAiB,kBAAkB,IAAK,EAAA,CAAA;AAC9C,IAAA,IAAI,eAAe,IAAM,EAAA;AACxB,MAAA,OAAA;AAAA,KACD;AAEA,IAAA,IAAI,eAAe,KAAO,EAAA;AACzB,MAAM,MAAA,sBAAA,CAAA;AAAA,KACP;AAAA,GACD;AACD,CAAA;AAfiB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"compress.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable of the first iterable based on the truthiness of the corresponding element in the second iterable.\n *\n * @param iterable An iterator that contains elements to be compressed.\n * @param selectors The selectors that determine which elements to include in the result.\n * @returns An iterator that contains only the elements from the input iterator that correspond to `true` values in the\n * selectors iterator.\n *\n * @example\n * ```typescript\n * import { compress } from '@sapphire/iterator-utilities';\n *\n * const iterable = compress([1, 2, 3, 4, 5], [true, false, true, false, true]);\n * console.log([...iterable]);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes both input iterators until either is exhausted.\n */\nexport function* compress<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tselectors: IterableResolvable<boolean>\n): IterableIterator<ElementType> {\n\tconst resolvedSelectors = from(selectors);\n\tfor (const resolvedIterableResult of toIterableIterator(iterable)) {\n\t\tconst selectorResult = resolvedSelectors.next();\n\t\tif (selectorResult.done) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (selectorResult.value) {\n\t\t\tyield resolvedIterableResult;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/compress.ts"],"names":["from","toIterableIterator"],"mappings":";;;;;;;AAwBO,UAAU,QAAA,CAChB,UACA,SACgC,EAAA;AAChC,EAAM,MAAA,iBAAA,GAAoBA,cAAK,SAAS,CAAA;AACxC,EAAW,KAAA,MAAA,sBAAA,IAA0BC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AAClE,IAAM,MAAA,cAAA,GAAiB,kBAAkB,IAAK,EAAA;AAC9C,IAAA,IAAI,eAAe,IAAM,EAAA;AACxB,MAAA;AAAA;AAGD,IAAA,IAAI,eAAe,KAAO,EAAA;AACzB,MAAM,MAAA,sBAAA;AAAA;AACP;AAEF;AAfiB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"compress.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable of the first iterable based on the truthiness of the corresponding element in the second iterable.\n *\n * @param iterable An iterator that contains elements to be compressed.\n * @param selectors The selectors that determine which elements to include in the result.\n * @returns An iterator that contains only the elements from the input iterator that correspond to `true` values in the\n * selectors iterator.\n *\n * @example\n * ```typescript\n * import { compress } from '@sapphire/iterator-utilities';\n *\n * const iterable = compress([1, 2, 3, 4, 5], [true, false, true, false, true]);\n * console.log([...iterable]);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes both input iterators until either is exhausted.\n */\nexport function* compress<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tselectors: IterableResolvable<boolean>\n): IterableIterator<ElementType> {\n\tconst resolvedSelectors = from(selectors);\n\tfor (const resolvedIterableResult of toIterableIterator(iterable)) {\n\t\tconst selectorResult = resolvedSelectors.next();\n\t\tif (selectorResult.done) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (selectorResult.value) {\n\t\t\tyield resolvedIterableResult;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/contains.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAuBO,SAAS,QAAA,CAA4B,UAA2C,KAA6B,EAAA;AACnH,EAAW,KAAA,MAAA,OAAA,IAAWA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAI,IAAA,OAAA,KAAY,OAAc,OAAA,IAAA,CAAA;AAAA,GAC/B;AAEA,EAAO,OAAA,KAAA,CAAA;AACR,CAAA;AANgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"contains.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable The iterator in which to locate a value.\n * @param value The value to locate in the iterator.\n * @returns `true` if the value is found in the iterator; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { contains } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(contains(iterable, 3));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function contains<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): boolean {\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) return true;\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/contains.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAuBO,SAAS,QAAA,CAA4B,UAA2C,KAA6B,EAAA;AACnH,EAAW,KAAA,MAAA,OAAA,IAAWA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAI,IAAA,OAAA,KAAY,OAAc,OAAA,IAAA;AAAA;AAG/B,EAAO,OAAA,KAAA;AACR;AANgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"contains.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable The iterator in which to locate a value.\n * @param value The value to locate in the iterator.\n * @returns `true` if the value is found in the iterator; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { contains } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(contains(iterable, 3));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function contains<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): boolean {\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) return true;\n\t}\n\n\treturn false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/count.ts"],"names":["count","from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAmD,EAAA;AAC3F,EAAA,IAAIA,MAAQ,GAAA,CAAA,CAAA;AACZ,EAAM,MAAA,gBAAA,GAAmBC,cAAK,QAAQ,CAAA,CAAA;AACtC,EAAA,OAAO,CAAC,gBAAA,CAAiB,IAAK,EAAA,CAAE,IAAM,EAAA;AACrC,IAAAD,MAAAA,EAAAA,CAAAA;AAAA,GACD;AAEA,EAAOA,OAAAA,MAAAA,CAAAA;AACR,CAAA;AARgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"count.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the iterable and returns the number of elements.\n *\n * @param iterable An iterator that contains elements to be counted.\n * @returns The number of elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { count } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(count(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function count<const ElementType>(iterable: IterableResolvable<ElementType>): number {\n\tlet count = 0;\n\tconst resolvedIterable = from(iterable);\n\twhile (!resolvedIterable.next().done) {\n\t\tcount++;\n\t}\n\n\treturn count;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/count.ts"],"names":["count","from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAmD,EAAA;AAC3F,EAAA,IAAIA,MAAQ,GAAA,CAAA;AACZ,EAAM,MAAA,gBAAA,GAAmBC,cAAK,QAAQ,CAAA;AACtC,EAAA,OAAO,CAAC,gBAAA,CAAiB,IAAK,EAAA,CAAE,IAAM,EAAA;AACrC,IAAAD,MAAAA,EAAAA;AAAA;AAGD,EAAOA,OAAAA,MAAAA;AACR;AARgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"count.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the iterable and returns the number of elements.\n *\n * @param iterable An iterator that contains elements to be counted.\n * @returns The number of elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { count } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(count(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function count<const ElementType>(iterable: IterableResolvable<ElementType>): number {\n\tlet count = 0;\n\tconst resolvedIterable = from(iterable);\n\twhile (!resolvedIterable.next().done) {\n\t\tcount++;\n\t}\n\n\treturn count;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/cycle.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAmBO,UAAU,MAAyB,QAA0E,EAAA;AACnH,EAAA,MAAM,UAAU,EAAC,CAAA;AACjB,EAAW,KAAA,MAAA,OAAA,IAAWA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAM,MAAA,OAAA,CAAA;AACN,IAAA,OAAA,CAAQ,KAAK,OAAO,CAAA,CAAA;AAAA,GACrB;AAEA,EAAO,OAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AAC1B,IAAA,KAAA,MAAW,WAAW,OAAS,EAAA;AAC9B,MAAM,MAAA,OAAA,CAAA;AAAA,KACP;AAAA,GACD;AACD,CAAA;AAZiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"cycle.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an infinite iterable by cycling through the elements of the input iterable.\n *\n * @param iterable An iterator to cycle over.\n *\n * @example\n * ```typescript\n * import { cycle } from '@sapphire/iterator-utilities';\n *\n * const iterable = cycle([1, 2, 3]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 1, 2, 3, 1, 2, 3, ...\n * }\n * ```\n */\nexport function* cycle<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst results = [] as ElementType[];\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield element;\n\t\tresults.push(element);\n\t}\n\n\twhile (results.length > 0) {\n\t\tfor (const element of results) {\n\t\t\tyield element;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/cycle.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAmBO,UAAU,MAAyB,QAA0E,EAAA;AACnH,EAAA,MAAM,UAAU,EAAC;AACjB,EAAW,KAAA,MAAA,OAAA,IAAWA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAM,MAAA,OAAA;AACN,IAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AAAA;AAGrB,EAAO,OAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AAC1B,IAAA,KAAA,MAAW,WAAW,OAAS,EAAA;AAC9B,MAAM,MAAA,OAAA;AAAA;AACP;AAEF;AAZiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"cycle.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an infinite iterable by cycling through the elements of the input iterable.\n *\n * @param iterable An iterator to cycle over.\n *\n * @example\n * ```typescript\n * import { cycle } from '@sapphire/iterator-utilities';\n *\n * const iterable = cycle([1, 2, 3]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 1, 2, 3, 1, 2, 3, ...\n * }\n * ```\n */\nexport function* cycle<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst results = [] as ElementType[];\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield element;\n\t\tresults.push(element);\n\t}\n\n\twhile (results.length > 0) {\n\t\tfor (const element of results) {\n\t\t\tyield element;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/difference.ts"],"names":["toIterableIterator","filter"],"mappings":";;;;;;;AAwBO,SAAS,UAAA,CACf,OACA,MACgC,EAAA;AAChC,EAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAAA,yCAAA,CAAmB,MAAM,CAAC,CAAA,CAAA;AAC9C,EAAO,OAAAC,iBAAA,CAAO,OAAO,CAAC,KAAA,KAAU,CAAC,GAAI,CAAA,GAAA,CAAI,KAAK,CAAC,CAAA,CAAA;AAChD,CAAA;AANgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"difference.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements of the first iterable that are not in the second iterable.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to exclude from the result.\n *\n * @example\n * ```typescript\n * import { difference } from '@sapphire/iterator-utilities';\n *\n * const first = [1, 2, 3, 4, 5];\n * const second = [3, 4, 5, 6, 7];\n * console.log([...difference(first, second)]);\n * // Output: [1, 2]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to exclude from `first`.\n */\nexport function difference<const ElementType>(\n\tfirst: IterableResolvable<ElementType>,\n\tsecond: IterableResolvable<ElementType>\n): IterableIterator<ElementType> {\n\tconst set = new Set(toIterableIterator(second));\n\treturn filter(first, (value) => !set.has(value));\n}\n\nexport { difference as except, difference as omit };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/difference.ts"],"names":["toIterableIterator","filter"],"mappings":";;;;;;;AAwBO,SAAS,UAAA,CACf,OACA,MACgC,EAAA;AAChC,EAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAAA,yCAAA,CAAmB,MAAM,CAAC,CAAA;AAC9C,EAAO,OAAAC,iBAAA,CAAO,OAAO,CAAC,KAAA,KAAU,CAAC,GAAI,CAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAChD;AANgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"difference.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements of the first iterable that are not in the second iterable.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to exclude from the result.\n *\n * @example\n * ```typescript\n * import { difference } from '@sapphire/iterator-utilities';\n *\n * const first = [1, 2, 3, 4, 5];\n * const second = [3, 4, 5, 6, 7];\n * console.log([...difference(first, second)]);\n * // Output: [1, 2]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to exclude from `first`.\n */\nexport function difference<const ElementType>(\n\tfirst: IterableResolvable<ElementType>,\n\tsecond: IterableResolvable<ElementType>\n): IterableIterator<ElementType> {\n\tconst set = new Set(toIterableIterator(second));\n\treturn filter(first, (value) => !set.has(value));\n}\n\nexport { difference as except, difference as omit };\n"]}
@@ -20,6 +20,5 @@ function drop(iterable, count) {
20
20
  __name(drop, "drop");
21
21
 
22
22
  exports.drop = drop;
23
- exports.skip = drop;
24
23
  //# sourceMappingURL=drop.cjs.map
25
24
  //# sourceMappingURL=drop.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/drop.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toIterableIterator","empty"],"mappings":";;;;;;;;;AAsBO,SAAS,IAAA,CAAwB,UAA2C,KAA8C,EAAA;AAChI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA,CAAA;AAClE,EAAM,MAAA,gBAAA,GAAmBC,0CAAmB,QAAQ,CAAA,CAAA;AAGpD,EAAI,IAAA,KAAA,KAAU,GAAU,OAAA,gBAAA,CAAA;AAExB,EAAA,IAAI,KAAU,KAAA,MAAA,CAAO,iBAAmB,EAAA,OAAOC,eAAM,EAAA,CAAA;AAErD,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,EAAO,CAAK,EAAA,EAAA;AAC/B,IAAI,IAAA,gBAAA,CAAiB,IAAK,EAAA,CAAE,IAAM,EAAA,MAAA;AAAA,GACnC;AAEA,EAAO,OAAA,gBAAA,CAAA;AACR,CAAA;AAdgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"drop.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable by `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of elements to drop from the start of the iteration.\n * @returns An iterator that contains the elements of the provided iterator, except for the first `count` elements.\n *\n * @example\n * ```typescript\n * import { drop } from '@sapphire/iterator-utilities';\n *\n * const iterable = drop(iterator, 2);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n */\nexport function drop<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst resolvedIterable = toIterableIterator(iterable);\n\n\t// If the count is 0, return the original iterable:\n\tif (count === 0) return resolvedIterable;\n\t// If the count is infinite, return an empty iterable:\n\tif (count === Number.POSITIVE_INFINITY) return empty();\n\n\tfor (let i = 0; i < count; i++) {\n\t\tif (resolvedIterable.next().done) break;\n\t}\n\n\treturn resolvedIterable;\n}\n\nexport { drop as skip };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/drop.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toIterableIterator","empty"],"mappings":";;;;;;;;;AAsBO,SAAS,IAAA,CAAwB,UAA2C,KAA8C,EAAA;AAChI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAM,MAAA,gBAAA,GAAmBC,0CAAmB,QAAQ,CAAA;AAGpD,EAAI,IAAA,KAAA,KAAU,GAAU,OAAA,gBAAA;AAExB,EAAA,IAAI,KAAU,KAAA,MAAA,CAAO,iBAAmB,EAAA,OAAOC,eAAM,EAAA;AAErD,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,EAAO,CAAK,EAAA,EAAA;AAC/B,IAAI,IAAA,gBAAA,CAAiB,IAAK,EAAA,CAAE,IAAM,EAAA;AAAA;AAGnC,EAAO,OAAA,gBAAA;AACR;AAdgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"drop.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable by `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of elements to drop from the start of the iteration.\n * @returns An iterator that contains the elements of the provided iterator, except for the first `count` elements.\n *\n * @example\n * ```typescript\n * import { drop } from '@sapphire/iterator-utilities';\n *\n * const iterable = drop(iterator, 2);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n */\nexport function drop<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst resolvedIterable = toIterableIterator(iterable);\n\n\t// If the count is 0, return the original iterable:\n\tif (count === 0) return resolvedIterable;\n\t// If the count is infinite, return an empty iterable:\n\tif (count === Number.POSITIVE_INFINITY) return empty();\n\n\tfor (let i = 0; i < count; i++) {\n\t\tif (resolvedIterable.next().done) break;\n\t}\n\n\treturn resolvedIterable;\n}\n"]}
@@ -18,4 +18,4 @@ import { IterableResolvable } from './from.cjs';
18
18
  */
19
19
  declare function drop<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType>;
20
20
 
21
- export { drop, drop as skip };
21
+ export { drop };
@@ -17,6 +17,5 @@ function dropLast(iterable, count) {
17
17
  __name(dropLast, "dropLast");
18
18
 
19
19
  exports.dropLast = dropLast;
20
- exports.skipLast = dropLast;
21
20
  //# sourceMappingURL=dropLast.cjs.map
22
21
  //# sourceMappingURL=dropLast.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dropLast.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toArray","empty","take"],"mappings":";;;;;;;;;;AA2BO,SAAS,QAAA,CAA4B,UAA2C,KAA8C,EAAA;AACpI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA,CAAA;AAClE,EAAM,MAAA,KAAA,GAAQC,oBAAQ,QAAQ,CAAA,CAAA;AAC9B,EAAA,IAAI,KAAM,CAAA,MAAA,IAAU,KAAO,EAAA,OAAOC,eAAM,EAAA,CAAA;AACxC,EAAA,OAAOC,cAAK,KAAM,CAAA,MAAA,EAAU,EAAA,KAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AACjD,CAAA;AALgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"dropLast.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable, creating a new iterator without the last `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of values to drop from the end of the iterator.\n * @returns An iterator that contains the elements of the provided iterator, except for the last `count` elements.\n *\n * @example\n * ```typescript\n * import { dropLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropLast([1, 2, 3, 4, 5], 2);\n * console.log([...iterable]);\n * // Output: [1, 2, 3]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function dropLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst array = toArray(iterable);\n\tif (array.length <= count) return empty();\n\treturn take(array.values(), array.length - count);\n}\n\nexport { dropLast as skipLast };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/dropLast.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toArray","empty","take"],"mappings":";;;;;;;;;;AA2BO,SAAS,QAAA,CAA4B,UAA2C,KAA8C,EAAA;AACpI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAM,MAAA,KAAA,GAAQC,oBAAQ,QAAQ,CAAA;AAC9B,EAAA,IAAI,KAAM,CAAA,MAAA,IAAU,KAAO,EAAA,OAAOC,eAAM,EAAA;AACxC,EAAA,OAAOC,cAAK,KAAM,CAAA,MAAA,EAAU,EAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AACjD;AALgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"dropLast.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable, creating a new iterator without the last `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of values to drop from the end of the iterator.\n * @returns An iterator that contains the elements of the provided iterator, except for the last `count` elements.\n *\n * @example\n * ```typescript\n * import { dropLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropLast([1, 2, 3, 4, 5], 2);\n * console.log([...iterable]);\n * // Output: [1, 2, 3]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function dropLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst array = toArray(iterable);\n\tif (array.length <= count) return empty();\n\treturn take(array.values(), array.length - count);\n}\n"]}
@@ -22,4 +22,4 @@ import { IterableResolvable } from './from.cjs';
22
22
  */
23
23
  declare function dropLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType>;
24
24
 
25
- export { dropLast, dropLast as skipLast };
25
+ export { dropLast };
@@ -17,6 +17,5 @@ function* dropWhile(iterable, callbackFn) {
17
17
  __name(dropWhile, "dropWhile");
18
18
 
19
19
  exports.dropWhile = dropWhile;
20
- exports.skipWhile = dropWhile;
21
20
  //# sourceMappingURL=dropWhile.cjs.map
22
21
  //# sourceMappingURL=dropWhile.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dropWhile.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA8BO,UAAU,SAAA,CAChB,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,CAAC,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,CAAG,EAAA;AAChC,MAAM,MAAA,KAAA,CAAA;AAAA,KACP;AAAA,GACD;AACD,CAAA;AAZiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"dropWhile.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterator without the elements that satisfy the specified test.\n *\n * @param iterable An iterator to drop values from.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a falsy value to make the element yielded by the iterator helper, and a truthy value otherwise.\n * @returns An iterator that produces elements from the given iterator that don't satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { dropWhile } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropWhile([1, 2, 3, 4, 5], (value) => value < 3);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @seealso {@link filter} or {@link takeWhile} for the opposite behavior.\n */\nexport function dropWhile<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<Exclude<ElementType, FilteredType>>;\nexport function dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) {\n\t\t\tyield value;\n\t\t}\n\t}\n}\n\nexport { dropWhile as skipWhile };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/dropWhile.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA8BO,UAAU,SAAA,CAChB,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,CAAC,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,CAAG,EAAA;AAChC,MAAM,MAAA,KAAA;AAAA;AACP;AAEF;AAZiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"dropWhile.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterator without the elements that satisfy the specified test.\n *\n * @param iterable An iterator to drop values from.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a falsy value to make the element yielded by the iterator helper, and a truthy value otherwise.\n * @returns An iterator that produces elements from the given iterator that don't satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { dropWhile } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropWhile([1, 2, 3, 4, 5], (value) => value < 3);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @seealso {@link filter} or {@link takeWhile} for the opposite behavior.\n */\nexport function dropWhile<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<Exclude<ElementType, FilteredType>>;\nexport function dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) {\n\t\t\tyield value;\n\t\t}\n\t}\n}\n"]}
@@ -21,4 +21,4 @@ import { IterableResolvable } from './from.cjs';
21
21
  declare function dropWhile<const ElementType, const FilteredType extends ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => element is FilteredType): IterableIterator<Exclude<ElementType, FilteredType>>;
22
22
  declare function dropWhile<const ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => boolean): IterableIterator<ElementType>;
23
23
 
24
- export { dropWhile, dropWhile as skipWhile };
24
+ export { dropWhile };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/empty.ts"],"names":["makeIterableIterator"],"mappings":";;;;;;AAgBO,SAAS,KAAkE,GAAA;AACjF,EAAA,OAAOA,+CAAkC,OAAO,EAAE,MAAM,IAAM,EAAA,KAAA,EAAO,QAAY,CAAA,CAAA,CAAA;AAClF,CAAA;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"empty.cjs","sourcesContent":["import { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an empty iterator.\n *\n * @returns An empty iterator.\n *\n * @example\n * ```typescript\n * import { empty } from '@sapphire/iterator-utilities';\n *\n * const iterable = empty();\n * console.log([...iterable]);\n * // Output: []\n * ```\n */\nexport function empty<const ElementType = never>(): IterableIterator<ElementType> {\n\treturn makeIterableIterator<ElementType>(() => ({ done: true, value: undefined }));\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/empty.ts"],"names":["makeIterableIterator"],"mappings":";;;;;;AAgBO,SAAS,KAAkE,GAAA;AACjF,EAAA,OAAOA,+CAAkC,OAAO,EAAE,MAAM,IAAM,EAAA,KAAA,EAAO,QAAY,CAAA,CAAA;AAClF;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"empty.cjs","sourcesContent":["import { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an empty iterator.\n *\n * @returns An empty iterator.\n *\n * @example\n * ```typescript\n * import { empty } from '@sapphire/iterator-utilities';\n *\n * const iterable = empty();\n * console.log([...iterable]);\n * // Output: []\n * ```\n */\nexport function empty<const ElementType = never>(): IterableIterator<ElementType> {\n\treturn makeIterableIterator<ElementType>(() => ({ done: true, value: undefined }));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/enumerate.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAsBO,UAAU,UAA6B,QAAoF,EAAA;AACjI,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAM,MAAA,CAAC,SAAS,KAAK,CAAA,CAAA;AAAA,GACtB;AACD,CAAA;AALiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"enumerate.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable that yields the index and value of each element.\n *\n * @param iterable An iterator to enumerate.\n * @returns An iterator that yields the index and value of each element in the source iterator.\n *\n * @example\n * ```typescript\n * import { enumerate } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['a', 'b', 'c'];\n * for (const [index, value] of enumerate(iterable)) {\n * \tconsole.log(`Index: ${index}, Value: ${value}`);\n * \t// Output: Index: 0, Value: a\n * \t// Output: Index: 1, Value: b\n * \t// Output: Index: 2, Value: c\n * }\n * ```\n */\nexport function* enumerate<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<[number, ElementType]> {\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield [index++, value];\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/enumerate.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAsBO,UAAU,UAA6B,QAAoF,EAAA;AACjI,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAM,MAAA,CAAC,SAAS,KAAK,CAAA;AAAA;AAEvB;AALiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"enumerate.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable that yields the index and value of each element.\n *\n * @param iterable An iterator to enumerate.\n * @returns An iterator that yields the index and value of each element in the source iterator.\n *\n * @example\n * ```typescript\n * import { enumerate } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['a', 'b', 'c'];\n * for (const [index, value] of enumerate(iterable)) {\n * \tconsole.log(`Index: ${index}, Value: ${value}`);\n * \t// Output: Index: 0, Value: a\n * \t// Output: Index: 1, Value: b\n * \t// Output: Index: 2, Value: c\n * }\n * ```\n */\nexport function* enumerate<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<[number, ElementType]> {\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield [index++, value];\n\t}\n}\n"]}
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ var equalBy_cjs = require('./equalBy.cjs');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ function equal(iterable, other) {
8
+ return equalBy_cjs.equalBy(iterable, other, (a, b) => a === b);
9
+ }
10
+ __name(equal, "equal");
11
+
12
+ exports.eq = equal;
13
+ exports.equal = equal;
14
+ //# sourceMappingURL=equal.cjs.map
15
+ //# sourceMappingURL=equal.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/equal.ts"],"names":["equalBy"],"mappings":";;;;;;AAwBO,SAAS,KAAA,CAAyB,UAA2C,KAAiD,EAAA;AACpI,EAAA,OAAOA,oBAAQ,QAAU,EAAA,KAAA,EAAO,CAAC,CAAG,EAAA,CAAA,KAAM,MAAM,CAAC,CAAA;AAClD;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"equal.cjs","sourcesContent":["import { equalBy } from './equalBy';\nimport type { IterableResolvable } from './from';\n\n/**\n * Determines if the elements of both iterators are equal.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { equal } from '@sapphire/iterator-utilities';\n *\n * console.log(equal([1], [1]));\n * // Output: true\n * console.log(equal([1], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function equal<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\treturn equalBy(iterable, other, (a, b) => a === b);\n}\n\nexport { equal as eq };\n"]}
@@ -0,0 +1,26 @@
1
+ import { IterableResolvable } from './from.cjs';
2
+
3
+ /**
4
+ * Determines if the elements of both iterators are equal.
5
+ *
6
+ * @param iterable The iterator to compare.
7
+ * @param other The iterator to compare against.
8
+ * @returns Whether the two iterators are equal.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { equal } from '@sapphire/iterator-utilities';
13
+ *
14
+ * console.log(equal([1], [1]));
15
+ * // Output: true
16
+ * console.log(equal([1], [1, 2]));
17
+ * // Output: false
18
+ * ```
19
+ *
20
+ * @remarks
21
+ *
22
+ * This function consumes the entire iterator.
23
+ */
24
+ declare function equal<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean;
25
+
26
+ export { equal as eq, equal };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var from_cjs = require('./from.cjs');
4
+ var _assertFunction_cjs = require('./shared/_assertFunction.cjs');
5
+ var toIterableIterator_cjs = require('./toIterableIterator.cjs');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ function equalBy(iterable, other, callbackFn) {
10
+ callbackFn = _assertFunction_cjs.assertFunction(callbackFn);
11
+ const iterator1 = from_cjs.from(other);
12
+ for (const value0 of toIterableIterator_cjs.toIterableIterator(iterable)) {
13
+ const result1 = iterator1.next();
14
+ if (result1.done || !callbackFn(value0, result1.value)) return false;
15
+ }
16
+ return iterator1.next().done === true;
17
+ }
18
+ __name(equalBy, "equalBy");
19
+
20
+ exports.eqBy = equalBy;
21
+ exports.equalBy = equalBy;
22
+ //# sourceMappingURL=equalBy.cjs.map
23
+ //# sourceMappingURL=equalBy.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/equalBy.ts"],"names":["assertFunction","from","toIterableIterator"],"mappings":";;;;;;;;AA0BO,SAAS,OAAA,CACf,QACA,EAAA,KAAA,EACA,UACU,EAAA;AACV,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,SAAA,GAAYC,cAAK,KAAK,CAAA;AAE5B,EAAW,KAAA,MAAA,MAAA,IAAUC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AAClD,IAAM,MAAA,OAAA,GAAU,UAAU,IAAK,EAAA;AAC/B,IAAI,IAAA,OAAA,CAAQ,QAAQ,CAAC,UAAA,CAAW,QAAQ,OAAQ,CAAA,KAAK,GAAU,OAAA,KAAA;AAAA;AAGhE,EAAO,OAAA,SAAA,CAAU,IAAK,EAAA,CAAE,IAAS,KAAA,IAAA;AAClC;AAfgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"equalBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Determines if the elements of both iterators are equal with respect to the specified equality function.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal with respect to the specified equality function.\n *\n * @example\n * ```typescript\n * import { equalBy } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n *\n * console.log(equalBy(x, y, (a, b) => a * a === b));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function equalBy<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tother: IterableResolvable<ElementType>,\n\tcallbackFn: (x: ElementType, y: ElementType) => boolean\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator1 = from(other);\n\n\tfor (const value0 of toIterableIterator(iterable)) {\n\t\tconst result1 = iterator1.next();\n\t\tif (result1.done || !callbackFn(value0, result1.value)) return false;\n\t}\n\n\treturn iterator1.next().done === true;\n}\n\nexport { equalBy as eqBy };\n"]}
@@ -0,0 +1,27 @@
1
+ import { IterableResolvable } from './from.cjs';
2
+
3
+ /**
4
+ * Determines if the elements of both iterators are equal with respect to the specified equality function.
5
+ *
6
+ * @param iterable The iterator to compare.
7
+ * @param other The iterator to compare against.
8
+ * @returns Whether the two iterators are equal with respect to the specified equality function.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { equalBy } from '@sapphire/iterator-utilities';
13
+ *
14
+ * const x = [1, 2, 3, 4];
15
+ * const y = [1, 4, 9, 16];
16
+ *
17
+ * console.log(equalBy(x, y, (a, b) => a * a === b));
18
+ * // Output: true
19
+ * ```
20
+ *
21
+ * @remarks
22
+ *
23
+ * This function consumes the entire iterator.
24
+ */
25
+ declare function equalBy<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>, callbackFn: (x: ElementType, y: ElementType) => boolean): boolean;
26
+
27
+ export { equalBy as eqBy, equalBy };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/every.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAmCO,SAAS,KAAA,CAAyB,UAA2C,UAA8D,EAAA;AACjJ,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,CAAC,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,GAAU,OAAA,KAAA,CAAA;AAAA,GACzC;AAEA,EAAO,OAAA,IAAA,CAAA;AACR,CAAA;AATgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"every.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Tests whether all elements in the iterable pass the test implemented by the provided function.\n *\n * @param iterable The iterator to check.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if callbackFn returns a truthy value for every element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { every } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(every(iterable, (value) => value < 10));\n * // Output: true\n *\n * console.log(every(iterable, (value) => value < 3));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function every<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): iterable is IterableIterator<FilteredType>;\nexport function every<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean;\nexport function every<const ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => boolean) {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) return false;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/every.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAmCO,SAAS,KAAA,CAAyB,UAA2C,UAA8D,EAAA;AACjJ,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,CAAC,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,GAAU,OAAA,KAAA;AAAA;AAGzC,EAAO,OAAA,IAAA;AACR;AATgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"every.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Tests whether all elements in the iterable pass the test implemented by the provided function.\n *\n * @param iterable The iterator to check.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if callbackFn returns a truthy value for every element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { every } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(every(iterable, (value) => value < 10));\n * // Output: true\n *\n * console.log(every(iterable, (value) => value < 3));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function every<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): iterable is IterableIterator<FilteredType>;\nexport function every<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean;\nexport function every<const ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => boolean) {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) return false;\n\t}\n\n\treturn true;\n}\n"]}
@@ -15,6 +15,5 @@ function* filter(iterable, callbackFn) {
15
15
  __name(filter, "filter");
16
16
 
17
17
  exports.filter = filter;
18
- exports.takeWhile = filter;
19
18
  //# sourceMappingURL=filter.cjs.map
20
19
  //# sourceMappingURL=filter.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/filter.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA4BO,UAAU,MAAA,CAChB,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,UAAW,CAAA,KAAA,EAAO,KAAO,EAAA,CAAA,EAAS,MAAA,KAAA,CAAA;AAAA,GACvC;AACD,CAAA;AAViB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"filter.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that pass the test implemented by the provided function.\n *\n * @param iterable The iterator to filter.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to make the element yielded by the iterator helper, and a falsy value otherwise.\n * @returns An iterator that produces elements from the given iterator that satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { filter } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...filter(iterable, (value) => value % 2 === 0)]);\n * // Output: [2, 4]\n * ```\n */\nexport function filter<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<FilteredType>;\nexport function filter<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* filter<ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) yield value;\n\t}\n}\n\nexport { filter as takeWhile };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/filter.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA4BO,UAAU,MAAA,CAChB,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,UAAW,CAAA,KAAA,EAAO,KAAO,EAAA,CAAA,EAAS,MAAA,KAAA;AAAA;AAExC;AAViB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"filter.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that pass the test implemented by the provided function.\n *\n * @param iterable The iterator to filter.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to make the element yielded by the iterator helper, and a falsy value otherwise.\n * @returns An iterator that produces elements from the given iterator that satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { filter } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...filter(iterable, (value) => value % 2 === 0)]);\n * // Output: [2, 4]\n * ```\n */\nexport function filter<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<FilteredType>;\nexport function filter<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* filter<ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) yield value;\n\t}\n}\n"]}
@@ -19,4 +19,4 @@ import { IterableResolvable } from './from.cjs';
19
19
  declare function filter<const ElementType, const FilteredType extends ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => element is FilteredType): IterableIterator<FilteredType>;
20
20
  declare function filter<const ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => boolean): IterableIterator<ElementType>;
21
21
 
22
- export { filter, filter as takeWhile };
22
+ export { filter };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/find.ts"],"names":["first","filter"],"mappings":";;;;;;;AAgCO,SAAS,IAAA,CACf,UACA,UAC0B,EAAA;AAC1B,EAAA,OAAOA,eAAM,CAAAC,iBAAA,CAAO,QAAU,EAAA,UAAU,CAAC,CAAA,CAAA;AAC1C,CAAA;AALgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"find.cjs","sourcesContent":["import { filter } from './filter';\nimport { first } from './first';\nimport type { IterableResolvable } from './from';\n\n/**\n * Advances the iterable until it finds the element, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function that determines if a value is the one being searched for.\n * @returns\n *\n * @example\n * ```typescript\n * import { find } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(find(iterable, (value) => value % 2 === 0));\n * // Output: 2\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function find<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): FilteredType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined {\n\treturn first(filter(iterable, callbackFn));\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/find.ts"],"names":["first","filter"],"mappings":";;;;;;;AAgCO,SAAS,IAAA,CACf,UACA,UAC0B,EAAA;AAC1B,EAAA,OAAOA,eAAM,CAAAC,iBAAA,CAAO,QAAU,EAAA,UAAU,CAAC,CAAA;AAC1C;AALgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"find.cjs","sourcesContent":["import { filter } from './filter';\nimport { first } from './first';\nimport type { IterableResolvable } from './from';\n\n/**\n * Advances the iterable until it finds the element, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function that determines if a value is the one being searched for.\n * @returns\n *\n * @example\n * ```typescript\n * import { find } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(find(iterable, (value) => value % 2 === 0));\n * // Output: 2\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function find<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): FilteredType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined {\n\treturn first(filter(iterable, callbackFn));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/findIndex.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAwBO,SAAS,SAAA,CACf,UACA,UACS,EAAA;AACT,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAI,IAAA,UAAA,CAAW,OAAS,EAAA,KAAK,CAAG,EAAA;AAC/B,MAAO,OAAA,KAAA,CAAA;AAAA,KACR;AAEA,IAAA,KAAA,EAAA,CAAA;AAAA,GACD;AAEA,EAAO,OAAA,CAAA,CAAA,CAAA;AACR,CAAA;AAhBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"findIndex.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning its index if it's found and `-1` otherwise.\n *\n * @param iterable An iterator to search for an element in.\n * @param callbackFn A function that determines if an element is the one being searched for.\n * @returns The index of the first element that satisfies the predicate, or `-1` if no elements satisfy the predicate.\n *\n * @example\n * ```typescript\n * import { findIndex } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(findIndex(iterable, (value) => value % 2 === 0));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function findIndex<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): number {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (callbackFn(element, index)) {\n\t\t\treturn index;\n\t\t}\n\n\t\tindex++;\n\t}\n\n\treturn -1;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/findIndex.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAwBO,SAAS,SAAA,CACf,UACA,UACS,EAAA;AACT,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAI,IAAA,UAAA,CAAW,OAAS,EAAA,KAAK,CAAG,EAAA;AAC/B,MAAO,OAAA,KAAA;AAAA;AAGR,IAAA,KAAA,EAAA;AAAA;AAGD,EAAO,OAAA,CAAA,CAAA;AACR;AAhBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"findIndex.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning its index if it's found and `-1` otherwise.\n *\n * @param iterable An iterator to search for an element in.\n * @param callbackFn A function that determines if an element is the one being searched for.\n * @returns The index of the first element that satisfies the predicate, or `-1` if no elements satisfy the predicate.\n *\n * @example\n * ```typescript\n * import { findIndex } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(findIndex(iterable, (value) => value % 2 === 0));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function findIndex<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): number {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (callbackFn(element, index)) {\n\t\t\treturn index;\n\t\t}\n\n\t\tindex++;\n\t}\n\n\treturn -1;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/first.ts"],"names":["from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAoE,EAAA;AAC5G,EAAA,OAAOA,aAAK,CAAA,QAAQ,CAAE,CAAA,IAAA,EAAO,CAAA,KAAA,CAAA;AAC9B,CAAA;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"first.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the first element of the iterable, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable The iterator to return the first value of.\n * @returns The first value of the iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { first } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(first(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function first<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\treturn from(iterable).next().value;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/first.ts"],"names":["from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAoE,EAAA;AAC5G,EAAA,OAAOA,aAAK,CAAA,QAAQ,CAAE,CAAA,IAAA,EAAO,CAAA,KAAA;AAC9B;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"first.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the first element of the iterable, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable The iterator to return the first value of.\n * @returns The first value of the iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { first } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(first(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function first<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\treturn from(iterable).next().value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/flat.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkBO,UAAU,KAAwB,SAA+F,EAAA;AACvI,EAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,SAAS,CAAG,EAAA;AAClD,IAAA,OAAOA,0CAAmB,KAAK,CAAA,CAAA;AAAA,GAChC;AACD,CAAA;AAJiB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"flat.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable in the input iterable.\n *\n * @param iterables An iterator to map.\n * @returns An iterator that yields the entries of each iterator.\n *\n * @example\n * ```typescript\n * import { flat } from '@sapphire/iterator-utilities';\n *\n * const iterable = flat([[1, 2], [3, 4], [5, 6]]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6]\n * ```\n */\nexport function* flat<const ElementType>(iterables: IterableResolvable<IterableResolvable<ElementType>>): IterableIterator<ElementType> {\n\tfor (const value of toIterableIterator(iterables)) {\n\t\tyield* toIterableIterator(value);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/flat.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkBO,UAAU,KAAwB,SAA+F,EAAA;AACvI,EAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,SAAS,CAAG,EAAA;AAClD,IAAA,OAAOA,0CAAmB,KAAK,CAAA;AAAA;AAEjC;AAJiB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"flat.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable in the input iterable.\n *\n * @param iterables An iterator to map.\n * @returns An iterator that yields the entries of each iterator.\n *\n * @example\n * ```typescript\n * import { flat } from '@sapphire/iterator-utilities';\n *\n * const iterable = flat([[1, 2], [3, 4], [5, 6]]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6]\n * ```\n */\nexport function* flat<const ElementType>(iterables: IterableResolvable<IterableResolvable<ElementType>>): IterableIterator<ElementType> {\n\tfor (const value of toIterableIterator(iterables)) {\n\t\tyield* toIterableIterator(value);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/flatMap.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAoBO,UAAU,OAAA,CAChB,UACA,UAC+B,EAAA;AAC/B,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,OAAOA,yCAAmB,CAAA,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,CAAC,CAAA,CAAA;AAAA,GACrD;AACD,CAAA;AAViB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"flatMap.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable returned by the provided function on each element of the input iterable.\n *\n * @param iterable An iterator to map.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return an iterator or iterable that yields elements to be yielded by `flatMap()`, or a single non-iterator/iterable value to be yielded.\n * @returns An iterator that applies a function to each element of the input iterator and yields the results.\n *\n * @example\n * ```typescript\n * import { flatMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3];\n * console.log([...flatMap(iterable, (value) => [value, value * 2])]);\n * // Output: [1, 2, 2, 4, 3, 6]\n * ```\n */\nexport function* flatMap<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => IterableResolvable<MappedType>\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield* toIterableIterator(callbackFn(value, index++));\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/flatMap.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAoBO,UAAU,OAAA,CAChB,UACA,UAC+B,EAAA;AAC/B,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,OAAOA,yCAAmB,CAAA,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,CAAC,CAAA;AAAA;AAEtD;AAViB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"flatMap.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable returned by the provided function on each element of the input iterable.\n *\n * @param iterable An iterator to map.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return an iterator or iterable that yields elements to be yielded by `flatMap()`, or a single non-iterator/iterable value to be yielded.\n * @returns An iterator that applies a function to each element of the input iterator and yields the results.\n *\n * @example\n * ```typescript\n * import { flatMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3];\n * console.log([...flatMap(iterable, (value) => [value, value * 2])]);\n * // Output: [1, 2, 2, 4, 3, 6]\n * ```\n */\nexport function* flatMap<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => IterableResolvable<MappedType>\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield* toIterableIterator(callbackFn(value, index++));\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/forEach.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAuBO,SAAS,OAAA,CACf,UACA,UACO,EAAA;AACP,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAA,UAAA,CAAW,SAAS,KAAO,EAAA,CAAA,CAAA;AAAA,GAC5B;AACD,CAAA;AAVgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"forEach.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Executes a provided function once for each iterable element.\n *\n * @param iterable An iterator to iterate over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is discarded.\n *\n * @example\n * ```typescript\n * import { forEach } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * forEach(iterable, (value) => console.log(value));\n * // Output: 1, 2, 3, 4, 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function forEach<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): void {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tcallbackFn(element, index++);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/forEach.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAuBO,SAAS,OAAA,CACf,UACA,UACO,EAAA;AACP,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAA,UAAA,CAAW,SAAS,KAAO,EAAA,CAAA;AAAA;AAE7B;AAVgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"forEach.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Executes a provided function once for each iterable element.\n *\n * @param iterable An iterator to iterate over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is discarded.\n *\n * @example\n * ```typescript\n * import { forEach } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * forEach(iterable, (value) => console.log(value));\n * // Output: 1, 2, 3, 4, 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function forEach<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): void {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tcallbackFn(element, index++);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/from.ts"],"names":[],"mappings":";;;;;;AAmBO,SAAS,KAAK,KAAY,EAAA;AAChC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,KAAA,KAAU,IAAM,EAAA;AAChD,IAAA,IAAI,OAAO,KAAA,CAAM,MAAO,CAAA,QAAQ,MAAM,UAAY,EAAA;AACjD,MAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA,CAAA;AAAA,KAC/B;AAEA,IAAI,IAAA,OAAO,KAAM,CAAA,IAAA,KAAS,UAAY,EAAA;AACrC,MAAO,OAAA,KAAA,CAAA;AAAA,KACR;AAAA,GACD;AAEA,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC9B,IAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA,CAAA;AAAA,GAC/B;AAEA,EAAA,MAAM,IAAI,SAAU,CAAA,CAAA,EAAG,MAAO,CAAA,KAAK,CAAC,CAAqC,mCAAA,CAAA,CAAA,CAAA;AAC1E,CAAA;AAhBgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"from.cjs","sourcesContent":["/**\n * Resolves an iterable from an iterable or iterator-like object.\n *\n * @param value The value to convert to an iterator.\n *\n * @example\n * ```typescript\n * import { from } from '@sapphire/iterator-utilities';\n *\n * const iterable = from([1, 2, 3, 4, 5]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 4, 5\n * }\n * ```\n */\nexport function from<const ElementType, const ResolvableType extends IterableResolvable<ElementType>>(\n\tvalue: ResolvableType\n): IterableResolved<ResolvableType>;\nexport function from(value: any) {\n\tif (typeof value === 'object' && value !== null) {\n\t\tif (typeof value[Symbol.iterator] === 'function') {\n\t\t\treturn value[Symbol.iterator]();\n\t\t}\n\n\t\tif (typeof value.next === 'function') {\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tif (typeof value === 'string') {\n\t\treturn value[Symbol.iterator]();\n\t}\n\n\tthrow new TypeError(`${String(value)} cannot be converted to an iterable`);\n}\n\nexport type IterableResolvable<ElementType> = Iterable<ElementType> | Iterator<ElementType> | IterableIterator<ElementType>;\n\nexport type IterableResolved<Type> =\n\tType extends IterableIterator<infer Output>\n\t\t? IterableIterator<Output>\n\t\t: Type extends Iterable<infer Output>\n\t\t\t? Iterator<Output>\n\t\t\t: Type extends Iterator<infer Output>\n\t\t\t\t? Iterator<Output>\n\t\t\t\t: never;\n"]}
1
+ {"version":3,"sources":["../../../src/lib/from.ts"],"names":[],"mappings":";;;;;;AAmBO,SAAS,KAAK,KAAY,EAAA;AAChC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,KAAA,KAAU,IAAM,EAAA;AAChD,IAAA,IAAI,OAAO,KAAA,CAAM,MAAO,CAAA,QAAQ,MAAM,UAAY,EAAA;AACjD,MAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA;AAAA;AAG/B,IAAI,IAAA,OAAO,KAAM,CAAA,IAAA,KAAS,UAAY,EAAA;AACrC,MAAO,OAAA,KAAA;AAAA;AACR;AAGD,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC9B,IAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA;AAAA;AAG/B,EAAA,MAAM,IAAI,SAAU,CAAA,CAAA,EAAG,MAAO,CAAA,KAAK,CAAC,CAAqC,mCAAA,CAAA,CAAA;AAC1E;AAhBgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"from.cjs","sourcesContent":["/**\n * Resolves an iterable from an iterable or iterator-like object.\n *\n * @param value The value to convert to an iterator.\n *\n * @example\n * ```typescript\n * import { from } from '@sapphire/iterator-utilities';\n *\n * const iterable = from([1, 2, 3, 4, 5]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 4, 5\n * }\n * ```\n */\nexport function from<const ElementType, const ResolvableType extends IterableResolvable<ElementType>>(\n\tvalue: ResolvableType\n): IterableResolved<ResolvableType>;\nexport function from(value: any) {\n\tif (typeof value === 'object' && value !== null) {\n\t\tif (typeof value[Symbol.iterator] === 'function') {\n\t\t\treturn value[Symbol.iterator]();\n\t\t}\n\n\t\tif (typeof value.next === 'function') {\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tif (typeof value === 'string') {\n\t\treturn value[Symbol.iterator]();\n\t}\n\n\tthrow new TypeError(`${String(value)} cannot be converted to an iterable`);\n}\n\nexport type IterableResolvable<ElementType> = Iterable<ElementType> | Iterator<ElementType> | IterableIterator<ElementType>;\n\nexport type IterableResolved<Type> =\n\tType extends IterableIterator<infer Output>\n\t\t? IterableIterator<Output>\n\t\t: Type extends Iterable<infer Output>\n\t\t\t? Iterator<Output>\n\t\t\t: Type extends Iterator<infer Output>\n\t\t\t\t? Iterator<Output>\n\t\t\t\t: never;\n"]}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ var _makeIterableIterator_cjs = require('./shared/_makeIterableIterator.cjs');
4
+ var toIterableIterator_cjs = require('./toIterableIterator.cjs');
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ function fuse(iterable) {
9
+ let ended = false;
10
+ const iterator = toIterableIterator_cjs.toIterableIterator(iterable);
11
+ return _makeIterableIterator_cjs.makeIterableIterator(() => {
12
+ if (ended) {
13
+ return { done: true, value: void 0 };
14
+ }
15
+ const result = iterator.next();
16
+ if (result.done) {
17
+ ended = true;
18
+ }
19
+ return result;
20
+ });
21
+ }
22
+ __name(fuse, "fuse");
23
+
24
+ exports.fuse = fuse;
25
+ //# sourceMappingURL=fuse.cjs.map
26
+ //# sourceMappingURL=fuse.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/fuse.ts"],"names":["toIterableIterator","makeIterableIterator"],"mappings":";;;;;;;AA8CO,SAAS,KAAwB,QAA0E,EAAA;AACjH,EAAA,IAAI,KAAQ,GAAA,KAAA;AACZ,EAAM,MAAA,QAAA,GAAWA,0CAAmB,QAAQ,CAAA;AAC5C,EAAA,OAAOC,+CAAqB,MAAM;AACjC,IAAA,IAAI,KAAO,EAAA;AACV,MAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,KAAU,CAAA,EAAA;AAAA;AAGvC,IAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,IAAA,IAAI,OAAO,IAAM,EAAA;AAChB,MAAQ,KAAA,GAAA,IAAA;AAAA;AAGT,IAAO,OAAA,MAAA;AAAA,GACP,CAAA;AACF;AAfgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"fuse.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterator which ends after the first `done` result from the original iterator.\n *\n * After an iterator returns a `done` result, future calls may or may not yield additional results again. This function\n * adapts an iterator, ensuring that after a `done` result is given, it will always return a `done` result forever.\n *\n * @param iterable An iterator to fuse.\n *\n * @example\n * ```typescript\n * import { fuse } from '@sapphire/iterator-utilities';\n *\n * const iterable = {\n * state: 0,\n * next() {\n * const value = this.state;\n * this.state += 1;\n *\n * return value % 2 === 0 //\n * ? { done: false, value }\n * : { done: true, value: undefined };\n * }\n * };\n *\n * // We can see our iterator going back and forth\n * assert(iterable.next(), { done: false, value: 0 });\n * assert(iterable.next(), { done: true, value: undefined });\n * assert(iterable.next(), { done: false, value: 2 });\n * assert(iterable.next(), { done: true, value: undefined });\n *\n * // However, once we fuse it...\n * const fused = fuse(iterable);\n *\n * assert(fused.next(), { done: false, value: 4 });\n * assert(fused.next(), { done: true, value: undefined });\n *\n * // It will always return a `done` result after the first time\n * assert(fused.next(), { done: true, value: undefined });\n * assert(fused.next(), { done: true, value: undefined });\n * assert(fused.next(), { done: true, value: undefined });\n * ```\n */\nexport function fuse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tlet ended = false;\n\tconst iterator = toIterableIterator(iterable);\n\treturn makeIterableIterator(() => {\n\t\tif (ended) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\tconst result = iterator.next();\n\t\tif (result.done) {\n\t\t\tended = true;\n\t\t}\n\n\t\treturn result;\n\t});\n}\n"]}
@@ -0,0 +1,47 @@
1
+ import { IterableResolvable } from './from.cjs';
2
+
3
+ /**
4
+ * Creates an iterator which ends after the first `done` result from the original iterator.
5
+ *
6
+ * After an iterator returns a `done` result, future calls may or may not yield additional results again. This function
7
+ * adapts an iterator, ensuring that after a `done` result is given, it will always return a `done` result forever.
8
+ *
9
+ * @param iterable An iterator to fuse.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { fuse } from '@sapphire/iterator-utilities';
14
+ *
15
+ * const iterable = {
16
+ * state: 0,
17
+ * next() {
18
+ * const value = this.state;
19
+ * this.state += 1;
20
+ *
21
+ * return value % 2 === 0 //
22
+ * ? { done: false, value }
23
+ * : { done: true, value: undefined };
24
+ * }
25
+ * };
26
+ *
27
+ * // We can see our iterator going back and forth
28
+ * assert(iterable.next(), { done: false, value: 0 });
29
+ * assert(iterable.next(), { done: true, value: undefined });
30
+ * assert(iterable.next(), { done: false, value: 2 });
31
+ * assert(iterable.next(), { done: true, value: undefined });
32
+ *
33
+ * // However, once we fuse it...
34
+ * const fused = fuse(iterable);
35
+ *
36
+ * assert(fused.next(), { done: false, value: 4 });
37
+ * assert(fused.next(), { done: true, value: undefined });
38
+ *
39
+ * // It will always return a `done` result after the first time
40
+ * assert(fused.next(), { done: true, value: undefined });
41
+ * assert(fused.next(), { done: true, value: undefined });
42
+ * assert(fused.next(), { done: true, value: undefined });
43
+ * ```
44
+ */
45
+ declare function fuse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType>;
46
+
47
+ export { fuse };
@@ -0,0 +1,17 @@
1
+ 'use strict';
2
+
3
+ var compare_cjs = require('./compare.cjs');
4
+ var _compare_cjs = require('./shared/_compare.cjs');
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ function greaterOrEqualThan(iterable, other) {
9
+ const result = compare_cjs.compare(iterable, other);
10
+ return !_compare_cjs.orderingIsLess(result);
11
+ }
12
+ __name(greaterOrEqualThan, "greaterOrEqualThan");
13
+
14
+ exports.ge = greaterOrEqualThan;
15
+ exports.greaterOrEqualThan = greaterOrEqualThan;
16
+ //# sourceMappingURL=greaterOrEqualThan.cjs.map
17
+ //# sourceMappingURL=greaterOrEqualThan.cjs.map