@sapphire/iterator-utilities 2.1.0-next.61eebdff → 2.1.0-next.644b9cd5

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 (199) hide show
  1. package/dist/cjs/lib/append.cjs.map +1 -1
  2. package/dist/cjs/lib/at.cjs.map +1 -1
  3. package/dist/cjs/lib/average.cjs.map +1 -1
  4. package/dist/cjs/lib/chain.cjs.map +1 -1
  5. package/dist/cjs/lib/chunk.cjs.map +1 -1
  6. package/dist/cjs/lib/collectInto.cjs.map +1 -1
  7. package/dist/cjs/lib/compact.cjs +1 -1
  8. package/dist/cjs/lib/compact.cjs.map +1 -1
  9. package/dist/cjs/lib/compare.cjs.map +1 -1
  10. package/dist/cjs/lib/compareBy.cjs.map +1 -1
  11. package/dist/cjs/lib/compress.cjs.map +1 -1
  12. package/dist/cjs/lib/contains.cjs.map +1 -1
  13. package/dist/cjs/lib/count.cjs.map +1 -1
  14. package/dist/cjs/lib/cycle.cjs.map +1 -1
  15. package/dist/cjs/lib/difference.cjs.map +1 -1
  16. package/dist/cjs/lib/drop.cjs.map +1 -1
  17. package/dist/cjs/lib/dropLast.cjs.map +1 -1
  18. package/dist/cjs/lib/dropWhile.cjs.map +1 -1
  19. package/dist/cjs/lib/empty.cjs +1 -1
  20. package/dist/cjs/lib/empty.cjs.map +1 -1
  21. package/dist/cjs/lib/enumerate.cjs.map +1 -1
  22. package/dist/cjs/lib/equal.cjs.map +1 -1
  23. package/dist/cjs/lib/equalBy.cjs.map +1 -1
  24. package/dist/cjs/lib/every.cjs.map +1 -1
  25. package/dist/cjs/lib/filter.cjs.map +1 -1
  26. package/dist/cjs/lib/find.cjs.map +1 -1
  27. package/dist/cjs/lib/findIndex.cjs.map +1 -1
  28. package/dist/cjs/lib/first.cjs.map +1 -1
  29. package/dist/cjs/lib/flat.cjs.map +1 -1
  30. package/dist/cjs/lib/flatMap.cjs.map +1 -1
  31. package/dist/cjs/lib/forEach.cjs.map +1 -1
  32. package/dist/cjs/lib/from.cjs.map +1 -1
  33. package/dist/cjs/lib/fuse.cjs +1 -1
  34. package/dist/cjs/lib/fuse.cjs.map +1 -1
  35. package/dist/cjs/lib/greaterOrEqualThan.cjs.map +1 -1
  36. package/dist/cjs/lib/greaterThan.cjs.map +1 -1
  37. package/dist/cjs/lib/indexOf.cjs.map +1 -1
  38. package/dist/cjs/lib/inspect.cjs.map +1 -1
  39. package/dist/cjs/lib/intersect.cjs.map +1 -1
  40. package/dist/cjs/lib/intersperse.cjs +1 -1
  41. package/dist/cjs/lib/intersperse.cjs.map +1 -1
  42. package/dist/cjs/lib/isEmpty.cjs.map +1 -1
  43. package/dist/cjs/lib/isSorted.cjs.map +1 -1
  44. package/dist/cjs/lib/isSortedBy.cjs.map +1 -1
  45. package/dist/cjs/lib/isSortedByKey.cjs.map +1 -1
  46. package/dist/cjs/lib/last.cjs.map +1 -1
  47. package/dist/cjs/lib/lessOrEqualThan.cjs.map +1 -1
  48. package/dist/cjs/lib/lessThan.cjs.map +1 -1
  49. package/dist/cjs/lib/map.cjs.map +1 -1
  50. package/dist/cjs/lib/max.cjs.map +1 -1
  51. package/dist/cjs/lib/maxBy.cjs.map +1 -1
  52. package/dist/cjs/lib/maxByKey.cjs.map +1 -1
  53. package/dist/cjs/lib/min.cjs.map +1 -1
  54. package/dist/cjs/lib/minBy.cjs.map +1 -1
  55. package/dist/cjs/lib/minByKey.cjs.map +1 -1
  56. package/dist/cjs/lib/notEqual.cjs.map +1 -1
  57. package/dist/cjs/lib/partition.cjs.map +1 -1
  58. package/dist/cjs/lib/peekable.cjs +1 -1
  59. package/dist/cjs/lib/peekable.cjs.map +1 -1
  60. package/dist/cjs/lib/prepend.cjs.map +1 -1
  61. package/dist/cjs/lib/product.cjs.map +1 -1
  62. package/dist/cjs/lib/range.cjs +1 -1
  63. package/dist/cjs/lib/range.cjs.map +1 -1
  64. package/dist/cjs/lib/reduce.cjs.map +1 -1
  65. package/dist/cjs/lib/repeat.cjs +1 -1
  66. package/dist/cjs/lib/repeat.cjs.map +1 -1
  67. package/dist/cjs/lib/reverse.cjs.map +1 -1
  68. package/dist/cjs/lib/shared/_assertFunction.cjs.map +1 -1
  69. package/dist/cjs/lib/shared/_assertNotNegative.cjs.map +1 -1
  70. package/dist/cjs/lib/shared/_assertPositive.cjs.map +1 -1
  71. package/dist/cjs/lib/shared/_compare.cjs.map +1 -1
  72. package/dist/cjs/lib/shared/_makeIterableIterator.cjs.map +1 -1
  73. package/dist/cjs/lib/shared/_toIntegerOrInfinityOrThrow.cjs.map +1 -1
  74. package/dist/cjs/lib/shared/_toIntegerOrThrow.cjs.map +1 -1
  75. package/dist/cjs/lib/shared/_toNumberOrThrow.cjs.map +1 -1
  76. package/dist/cjs/lib/shared/comparators.cjs.map +1 -1
  77. package/dist/cjs/lib/slice.cjs +1 -1
  78. package/dist/cjs/lib/slice.cjs.map +1 -1
  79. package/dist/cjs/lib/some.cjs.map +1 -1
  80. package/dist/cjs/lib/sorted.cjs.map +1 -1
  81. package/dist/cjs/lib/starMap.cjs.map +1 -1
  82. package/dist/cjs/lib/stepBy.cjs +1 -1
  83. package/dist/cjs/lib/stepBy.cjs.map +1 -1
  84. package/dist/cjs/lib/sum.cjs.map +1 -1
  85. package/dist/cjs/lib/take.cjs +1 -1
  86. package/dist/cjs/lib/take.cjs.map +1 -1
  87. package/dist/cjs/lib/takeLast.cjs +1 -1
  88. package/dist/cjs/lib/takeLast.cjs.map +1 -1
  89. package/dist/cjs/lib/tee.cjs +1 -1
  90. package/dist/cjs/lib/tee.cjs.map +1 -1
  91. package/dist/cjs/lib/toArray.cjs.map +1 -1
  92. package/dist/cjs/lib/toIterableIterator.cjs.map +1 -1
  93. package/dist/cjs/lib/union.cjs.map +1 -1
  94. package/dist/cjs/lib/unique.cjs.map +1 -1
  95. package/dist/cjs/lib/unzip.cjs.map +1 -1
  96. package/dist/cjs/lib/windows.cjs +1 -1
  97. package/dist/cjs/lib/windows.cjs.map +1 -1
  98. package/dist/cjs/lib/zip.cjs.map +1 -1
  99. package/dist/esm/lib/append.mjs.map +1 -1
  100. package/dist/esm/lib/at.mjs.map +1 -1
  101. package/dist/esm/lib/average.mjs.map +1 -1
  102. package/dist/esm/lib/chain.mjs.map +1 -1
  103. package/dist/esm/lib/chunk.mjs.map +1 -1
  104. package/dist/esm/lib/collectInto.mjs.map +1 -1
  105. package/dist/esm/lib/compact.mjs +1 -1
  106. package/dist/esm/lib/compact.mjs.map +1 -1
  107. package/dist/esm/lib/compare.mjs.map +1 -1
  108. package/dist/esm/lib/compareBy.mjs.map +1 -1
  109. package/dist/esm/lib/compress.mjs.map +1 -1
  110. package/dist/esm/lib/contains.mjs.map +1 -1
  111. package/dist/esm/lib/count.mjs.map +1 -1
  112. package/dist/esm/lib/cycle.mjs.map +1 -1
  113. package/dist/esm/lib/difference.mjs.map +1 -1
  114. package/dist/esm/lib/drop.mjs.map +1 -1
  115. package/dist/esm/lib/dropLast.mjs.map +1 -1
  116. package/dist/esm/lib/dropWhile.mjs.map +1 -1
  117. package/dist/esm/lib/empty.mjs +1 -1
  118. package/dist/esm/lib/empty.mjs.map +1 -1
  119. package/dist/esm/lib/enumerate.mjs.map +1 -1
  120. package/dist/esm/lib/equal.mjs.map +1 -1
  121. package/dist/esm/lib/equalBy.mjs.map +1 -1
  122. package/dist/esm/lib/every.mjs.map +1 -1
  123. package/dist/esm/lib/filter.mjs.map +1 -1
  124. package/dist/esm/lib/find.mjs.map +1 -1
  125. package/dist/esm/lib/findIndex.mjs.map +1 -1
  126. package/dist/esm/lib/first.mjs.map +1 -1
  127. package/dist/esm/lib/flat.mjs.map +1 -1
  128. package/dist/esm/lib/flatMap.mjs.map +1 -1
  129. package/dist/esm/lib/forEach.mjs.map +1 -1
  130. package/dist/esm/lib/from.mjs.map +1 -1
  131. package/dist/esm/lib/fuse.mjs +1 -1
  132. package/dist/esm/lib/fuse.mjs.map +1 -1
  133. package/dist/esm/lib/greaterOrEqualThan.mjs.map +1 -1
  134. package/dist/esm/lib/greaterThan.mjs.map +1 -1
  135. package/dist/esm/lib/indexOf.mjs.map +1 -1
  136. package/dist/esm/lib/inspect.mjs.map +1 -1
  137. package/dist/esm/lib/intersect.mjs.map +1 -1
  138. package/dist/esm/lib/intersperse.mjs +1 -1
  139. package/dist/esm/lib/intersperse.mjs.map +1 -1
  140. package/dist/esm/lib/isEmpty.mjs.map +1 -1
  141. package/dist/esm/lib/isSorted.mjs.map +1 -1
  142. package/dist/esm/lib/isSortedBy.mjs.map +1 -1
  143. package/dist/esm/lib/isSortedByKey.mjs.map +1 -1
  144. package/dist/esm/lib/last.mjs.map +1 -1
  145. package/dist/esm/lib/lessOrEqualThan.mjs.map +1 -1
  146. package/dist/esm/lib/lessThan.mjs.map +1 -1
  147. package/dist/esm/lib/map.mjs.map +1 -1
  148. package/dist/esm/lib/max.mjs.map +1 -1
  149. package/dist/esm/lib/maxBy.mjs.map +1 -1
  150. package/dist/esm/lib/maxByKey.mjs.map +1 -1
  151. package/dist/esm/lib/min.mjs.map +1 -1
  152. package/dist/esm/lib/minBy.mjs.map +1 -1
  153. package/dist/esm/lib/minByKey.mjs.map +1 -1
  154. package/dist/esm/lib/notEqual.mjs.map +1 -1
  155. package/dist/esm/lib/partition.mjs.map +1 -1
  156. package/dist/esm/lib/peekable.mjs +1 -1
  157. package/dist/esm/lib/peekable.mjs.map +1 -1
  158. package/dist/esm/lib/prepend.mjs.map +1 -1
  159. package/dist/esm/lib/product.mjs.map +1 -1
  160. package/dist/esm/lib/range.mjs +1 -1
  161. package/dist/esm/lib/range.mjs.map +1 -1
  162. package/dist/esm/lib/reduce.mjs.map +1 -1
  163. package/dist/esm/lib/repeat.mjs +1 -1
  164. package/dist/esm/lib/repeat.mjs.map +1 -1
  165. package/dist/esm/lib/reverse.mjs.map +1 -1
  166. package/dist/esm/lib/shared/_assertFunction.mjs.map +1 -1
  167. package/dist/esm/lib/shared/_assertNotNegative.mjs.map +1 -1
  168. package/dist/esm/lib/shared/_assertPositive.mjs.map +1 -1
  169. package/dist/esm/lib/shared/_compare.mjs.map +1 -1
  170. package/dist/esm/lib/shared/_makeIterableIterator.mjs.map +1 -1
  171. package/dist/esm/lib/shared/_toIntegerOrInfinityOrThrow.mjs.map +1 -1
  172. package/dist/esm/lib/shared/_toIntegerOrThrow.mjs.map +1 -1
  173. package/dist/esm/lib/shared/_toNumberOrThrow.mjs.map +1 -1
  174. package/dist/esm/lib/shared/comparators.mjs.map +1 -1
  175. package/dist/esm/lib/slice.mjs +1 -1
  176. package/dist/esm/lib/slice.mjs.map +1 -1
  177. package/dist/esm/lib/some.mjs.map +1 -1
  178. package/dist/esm/lib/sorted.mjs.map +1 -1
  179. package/dist/esm/lib/starMap.mjs.map +1 -1
  180. package/dist/esm/lib/stepBy.mjs +1 -1
  181. package/dist/esm/lib/stepBy.mjs.map +1 -1
  182. package/dist/esm/lib/sum.mjs.map +1 -1
  183. package/dist/esm/lib/take.mjs +1 -1
  184. package/dist/esm/lib/take.mjs.map +1 -1
  185. package/dist/esm/lib/takeLast.mjs +1 -1
  186. package/dist/esm/lib/takeLast.mjs.map +1 -1
  187. package/dist/esm/lib/tee.mjs +1 -1
  188. package/dist/esm/lib/tee.mjs.map +1 -1
  189. package/dist/esm/lib/toArray.mjs.map +1 -1
  190. package/dist/esm/lib/toIterableIterator.mjs.map +1 -1
  191. package/dist/esm/lib/union.mjs.map +1 -1
  192. package/dist/esm/lib/unique.mjs.map +1 -1
  193. package/dist/esm/lib/unzip.mjs.map +1 -1
  194. package/dist/esm/lib/windows.mjs +1 -1
  195. package/dist/esm/lib/windows.mjs.map +1 -1
  196. package/dist/esm/lib/zip.mjs.map +1 -1
  197. package/dist/iife/index.global.js +13 -13
  198. package/dist/iife/index.global.js.map +1 -1
  199. package/package.json +6 -6
@@ -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;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.mjs","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,KAAA,EAAY;AAChC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,EAAM;AAChD,IAAA,IAAI,OAAO,KAAA,CAAM,MAAA,CAAO,QAAQ,MAAM,UAAA,EAAY;AACjD,MAAA,OAAO,KAAA,CAAM,MAAA,CAAO,QAAQ,CAAA,EAAE;AAAA,IAC/B;AAEA,IAAA,IAAI,OAAO,KAAA,CAAM,IAAA,KAAS,UAAA,EAAY;AACrC,MAAA,OAAO,KAAA;AAAA,IACR;AAAA,EACD;AAEA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC9B,IAAA,OAAO,KAAA,CAAM,MAAA,CAAO,QAAQ,CAAA,EAAE;AAAA,EAC/B;AAEA,EAAA,MAAM,IAAI,SAAA,CAAU,CAAA,EAAG,MAAA,CAAO,KAAK,CAAC,CAAA,mCAAA,CAAqC,CAAA;AAC1E;AAhBgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"from.mjs","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"]}
@@ -7,7 +7,7 @@ function fuse(iterable) {
7
7
  const iterator = toIterableIterator(iterable);
8
8
  return makeIterableIterator(() => {
9
9
  if (ended) {
10
- return { done: true, value: undefined };
10
+ return { done: true, value: void 0 };
11
11
  }
12
12
  const result = iterator.next();
13
13
  if (result.done) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/fuse.ts"],"names":[],"mappings":";;;;AA8CO,SAAS,KAAwB,QAA0E,EAAA;AACjH,EAAA,IAAI,KAAQ,GAAA,KAAA;AACZ,EAAM,MAAA,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,OAAO,qBAAqB,MAAM;AACjC,IAAA,IAAI,KAAO,EAAA;AACV,MAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,SAAU,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.mjs","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"]}
1
+ {"version":3,"sources":["../../../src/lib/fuse.ts"],"names":[],"mappings":";;;;AA8CO,SAAS,KAAwB,QAAA,EAA0E;AACjH,EAAA,IAAI,KAAA,GAAQ,KAAA;AACZ,EAAA,MAAM,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,OAAO,qBAAqB,MAAM;AACjC,IAAA,IAAI,KAAA,EAAO;AACV,MAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU;AAAA,IACvC;AAEA,IAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,IAAA,IAAI,OAAO,IAAA,EAAM;AAChB,MAAA,KAAA,GAAQ,IAAA;AAAA,IACT;AAEA,IAAA,OAAO,MAAA;AAAA,EACR,CAAC,CAAA;AACF;AAfgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"fuse.mjs","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"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/greaterOrEqualThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,kBAAA,CAAsC,UAA2C,KAAiD,EAAA;AACjJ,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAO,OAAA,CAAC,eAAe,MAAM,CAAA;AAC9B;AAHgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA","file":"greaterOrEqualThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsLess, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} greater or equal than\n * those of another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterOrEqualThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterOrEqualThan([1], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterOrEqualThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1, 2], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterOrEqualThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn !orderingIsLess(result);\n}\n\nexport { greaterOrEqualThan as ge };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/greaterOrEqualThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,kBAAA,CAAsC,UAA2C,KAAA,EAAiD;AACjJ,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,CAAC,eAAe,MAAM,CAAA;AAC9B;AAHgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA","file":"greaterOrEqualThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsLess, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} greater or equal than\n * those of another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterOrEqualThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterOrEqualThan([1], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterOrEqualThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1, 2], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterOrEqualThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn !orderingIsLess(result);\n}\n\nexport { greaterOrEqualThan as ge };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/greaterThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,WAAA,CAA+B,UAA2C,KAAiD,EAAA;AAC1I,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,kBAAkB,MAAM,CAAA;AAChC;AAHgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"greaterThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsGreater, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} greater than those of\n * another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterThan([1], [1]));\n * // Output: false\n * console.log(greaterThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterThan([1, 2], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn orderingIsGreater(result);\n}\n\nexport { greaterThan as gt };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/greaterThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,WAAA,CAA+B,UAA2C,KAAA,EAAiD;AAC1I,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,kBAAkB,MAAM,CAAA;AAChC;AAHgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"greaterThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsGreater, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} greater than those of\n * another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterThan([1], [1]));\n * // Output: false\n * console.log(greaterThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterThan([1, 2], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn orderingIsGreater(result);\n}\n\nexport { greaterThan as gt };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/indexOf.ts"],"names":[],"mappings":";;;AAuBO,SAAS,OAAA,CAA2B,UAA2C,KAA4B,EAAA;AACjH,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAW,kBAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAA,IAAI,YAAY,KAAO,EAAA;AACtB,MAAO,OAAA,KAAA;AAAA;AAGR,IAAA,KAAA,EAAA;AAAA;AAGD,EAAO,OAAA,EAAA;AACR;AAXgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"indexOf.mjs","sourcesContent":["import type { IterableResolvable } from './from';\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 a value in.\n * @param value The value to search for.\n * @returns The index of the first occurrence of the value in the iterator, or `-1` if the value is not found.\n *\n * @example\n * ```typescript\n * import { indexOf } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(indexOf(iterable, 3));\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 indexOf<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): number {\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) {\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/indexOf.ts"],"names":[],"mappings":";;;AAuBO,SAAS,OAAA,CAA2B,UAA2C,KAAA,EAA4B;AACjH,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,OAAA,IAAW,kBAAA,CAAmB,QAAQ,CAAA,EAAG;AACnD,IAAA,IAAI,YAAY,KAAA,EAAO;AACtB,MAAA,OAAO,KAAA;AAAA,IACR;AAEA,IAAA,KAAA,EAAA;AAAA,EACD;AAEA,EAAA,OAAO,EAAA;AACR;AAXgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"indexOf.mjs","sourcesContent":["import type { IterableResolvable } from './from';\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 a value in.\n * @param value The value to search for.\n * @returns The index of the first occurrence of the value in the iterator, or `-1` if the value is not found.\n *\n * @example\n * ```typescript\n * import { indexOf } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(indexOf(iterable, 3));\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 indexOf<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): number {\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) {\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/inspect.ts"],"names":[],"mappings":";;;;;AAsCO,SAAS,OAAA,CACf,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAM,MAAA,QAAA,GAAW,KAAK,QAAQ,CAAA;AAC9B,EAAA,OAAO,qBAAkC,MAAM;AAC9C,IAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,IAAI,IAAA,CAAC,OAAO,IAAM,EAAA;AACjB,MAAW,UAAA,CAAA,MAAA,CAAO,OAAO,KAAO,EAAA,CAAA;AAAA;AAGjC,IAAO,OAAA,MAAA;AAAA,GACP,CAAA;AACF;AAhBgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"inspect.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Does something with each element of an iterator, passing the value on.\n *\n * When using iterators, you'll often chain several of them together. While working on such code, you might want to\n * check out what's happening at various parts in the pipeline. To do that, insert a call to this function.\n *\n * It's more common for this function to be used as a debugging tool than to exist in your final code, but applications\n * may find it useful in certain situations when errors need to be logged before being discarded.\n *\n * @param iterable An iterator to inspect.\n *\n * @example\n * ```typescript\n * import { inspect } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 4, 2, 3];\n *\n * let iter = inspect(iter, (value) => console.log(`about to filter: ${value}`));\n * iter = filter(iterable, (value) => value % 2 === 0);\n * iter = inspect(iter, (value) => console.log(`made it through filter: ${value}`));\n *\n * const sum = reduce(iter, (acc, value) => acc + value, 0);\n * console.log(sum);\n *\n * // Output:\n * // about to filter: 1\n * // about to filter: 4\n * // made it through filter: 4\n * // about to filter: 2\n * // made it through filter: 2\n * // about to filter: 3\n * // 6\n * ```\n */\nexport function inspect<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tconst result = iterator.next();\n\t\tif (!result.done) {\n\t\t\tcallbackFn(result.value, index++);\n\t\t}\n\n\t\treturn result;\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/inspect.ts"],"names":[],"mappings":";;;;;AAsCO,SAAS,OAAA,CACf,UACA,UAAA,EACgC;AAChC,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,MAAM,QAAA,GAAW,KAAK,QAAQ,CAAA;AAC9B,EAAA,OAAO,qBAAkC,MAAM;AAC9C,IAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,IAAA,IAAI,CAAC,OAAO,IAAA,EAAM;AACjB,MAAA,UAAA,CAAW,MAAA,CAAO,OAAO,KAAA,EAAO,CAAA;AAAA,IACjC;AAEA,IAAA,OAAO,MAAA;AAAA,EACR,CAAC,CAAA;AACF;AAhBgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"inspect.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Does something with each element of an iterator, passing the value on.\n *\n * When using iterators, you'll often chain several of them together. While working on such code, you might want to\n * check out what's happening at various parts in the pipeline. To do that, insert a call to this function.\n *\n * It's more common for this function to be used as a debugging tool than to exist in your final code, but applications\n * may find it useful in certain situations when errors need to be logged before being discarded.\n *\n * @param iterable An iterator to inspect.\n *\n * @example\n * ```typescript\n * import { inspect } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 4, 2, 3];\n *\n * let iter = inspect(iter, (value) => console.log(`about to filter: ${value}`));\n * iter = filter(iterable, (value) => value % 2 === 0);\n * iter = inspect(iter, (value) => console.log(`made it through filter: ${value}`));\n *\n * const sum = reduce(iter, (acc, value) => acc + value, 0);\n * console.log(sum);\n *\n * // Output:\n * // about to filter: 1\n * // about to filter: 4\n * // made it through filter: 4\n * // about to filter: 2\n * // made it through filter: 2\n * // about to filter: 3\n * // 6\n * ```\n */\nexport function inspect<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tconst result = iterator.next();\n\t\tif (!result.done) {\n\t\t\tcallbackFn(result.value, index++);\n\t\t}\n\n\t\treturn result;\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/intersect.ts"],"names":[],"mappings":";;;;AAyBO,SAAS,SAAA,CACf,OACA,MACgC,EAAA;AAChC,EAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAA,kBAAA,CAAmB,MAAM,CAAC,CAAA;AAC9C,EAAA,OAAO,OAAO,KAAO,EAAA,CAAC,UAAU,GAAI,CAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAC/C;AANgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"intersect.mjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in both input iterables.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to include in the result.\n *\n * @example\n * ```typescript\n * import { intersect } from '@sapphire/iterator-utilities';\n *\n * const iterable = intersect([1, 2, 3, 4, 5], [3, 4, 5, 6, 7]);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to intersect with `first`.\n *\n * @seealso {@link difference} for the opposite behavior.\n */\nexport function intersect<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"]}
1
+ {"version":3,"sources":["../../../src/lib/intersect.ts"],"names":[],"mappings":";;;;AAyBO,SAAS,SAAA,CACf,OACA,MAAA,EACgC;AAChC,EAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAI,kBAAA,CAAmB,MAAM,CAAC,CAAA;AAC9C,EAAA,OAAO,OAAO,KAAA,EAAO,CAAC,UAAU,GAAA,CAAI,GAAA,CAAI,KAAK,CAAC,CAAA;AAC/C;AANgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"intersect.mjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in both input iterables.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to include in the result.\n *\n * @example\n * ```typescript\n * import { intersect } from '@sapphire/iterator-utilities';\n *\n * const iterable = intersect([1, 2, 3, 4, 5], [3, 4, 5, 6, 7]);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to intersect with `first`.\n *\n * @seealso {@link difference} for the opposite behavior.\n */\nexport function intersect<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"]}
@@ -15,7 +15,7 @@ function intersperse(iterable, separator) {
15
15
  }
16
16
  const result = iterator.next();
17
17
  if (result.done) {
18
- return { done: true, value: undefined };
18
+ return { done: true, value: void 0 };
19
19
  }
20
20
  nextItem = result.value;
21
21
  nextItemTaken = true;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/intersperse.ts"],"names":[],"mappings":";;;;AA4BO,SAAS,WAAA,CAA+B,UAA2C,SAAuD,EAAA;AAChJ,EAAA,IAAI,OAAU,GAAA,KAAA;AACd,EAAI,IAAA,QAAA;AACJ,EAAA,IAAI,aAAgB,GAAA,KAAA;AAEpB,EAAM,MAAA,QAAA,GAAW,KAAK,QAAQ,CAAA;AAC9B,EAAA,OAAO,qBAAkC,MAAM;AAC9C,IAAA,IAAI,OAAS,EAAA;AACZ,MAAA,IAAI,aAAe,EAAA;AAClB,QAAgB,aAAA,GAAA,KAAA;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAO,QAAS,EAAA;AAAA;AAGvC,MAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,MAAA,IAAI,OAAO,IAAM,EAAA;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,SAAU,EAAA;AAAA;AAGvC,MAAA,QAAA,GAAW,MAAO,CAAA,KAAA;AAClB,MAAgB,aAAA,GAAA,IAAA;AAChB,MAAA,OAAO,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAO,SAAU,EAAA;AAAA;AAGxC,IAAU,OAAA,GAAA,IAAA;AACV,IAAA,OAAO,SAAS,IAAK,EAAA;AAAA,GACrB,CAAA;AACF;AA1BgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"intersperse.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates a new iterator which places `separator` between adjacent items of the original iterator.\n *\n * @param iterable An iterator to map over.\n * @param separator The separator to place between adjacent items.\n *\n * @example\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = [0, 1, 2];\n * console.log([...intersperse(iterable, 100)]);\n * // Output: [0, 100, 1, 100, 2]\n * ```\n *\n * @example\n * `intersperse` can be very useful to join an iterator's items using a common element:\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['Hello', 'World', '!'];\n * console.log([...intersperse(iterable, ', ')].join(''));\n * // Output: 'Hello, World, !'\n * ```\n */\nexport function intersperse<const ElementType>(iterable: IterableResolvable<ElementType>, separator: ElementType): IterableIterator<ElementType> {\n\tlet started = false;\n\tlet nextItem: ElementType;\n\tlet nextItemTaken = false;\n\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (started) {\n\t\t\tif (nextItemTaken) {\n\t\t\t\tnextItemTaken = false;\n\t\t\t\treturn { done: false, value: nextItem };\n\t\t\t}\n\n\t\t\tconst result = iterator.next();\n\t\t\tif (result.done) {\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\n\t\t\tnextItem = result.value;\n\t\t\tnextItemTaken = true;\n\t\t\treturn { done: false, value: separator };\n\t\t}\n\n\t\tstarted = true;\n\t\treturn iterator.next();\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/intersperse.ts"],"names":[],"mappings":";;;;AA4BO,SAAS,WAAA,CAA+B,UAA2C,SAAA,EAAuD;AAChJ,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI,aAAA,GAAgB,KAAA;AAEpB,EAAA,MAAM,QAAA,GAAW,KAAK,QAAQ,CAAA;AAC9B,EAAA,OAAO,qBAAkC,MAAM;AAC9C,IAAA,IAAI,OAAA,EAAS;AACZ,MAAA,IAAI,aAAA,EAAe;AAClB,QAAA,aAAA,GAAgB,KAAA;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,QAAA,EAAS;AAAA,MACvC;AAEA,MAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,MAAA,IAAI,OAAO,IAAA,EAAM;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU;AAAA,MACvC;AAEA,MAAA,QAAA,GAAW,MAAA,CAAO,KAAA;AAClB,MAAA,aAAA,GAAgB,IAAA;AAChB,MAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,SAAA,EAAU;AAAA,IACxC;AAEA,IAAA,OAAA,GAAU,IAAA;AACV,IAAA,OAAO,SAAS,IAAA,EAAK;AAAA,EACtB,CAAC,CAAA;AACF;AA1BgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"intersperse.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates a new iterator which places `separator` between adjacent items of the original iterator.\n *\n * @param iterable An iterator to map over.\n * @param separator The separator to place between adjacent items.\n *\n * @example\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = [0, 1, 2];\n * console.log([...intersperse(iterable, 100)]);\n * // Output: [0, 100, 1, 100, 2]\n * ```\n *\n * @example\n * `intersperse` can be very useful to join an iterator's items using a common element:\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['Hello', 'World', '!'];\n * console.log([...intersperse(iterable, ', ')].join(''));\n * // Output: 'Hello, World, !'\n * ```\n */\nexport function intersperse<const ElementType>(iterable: IterableResolvable<ElementType>, separator: ElementType): IterableIterator<ElementType> {\n\tlet started = false;\n\tlet nextItem: ElementType;\n\tlet nextItemTaken = false;\n\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (started) {\n\t\t\tif (nextItemTaken) {\n\t\t\t\tnextItemTaken = false;\n\t\t\t\treturn { done: false, value: nextItem };\n\t\t\t}\n\n\t\t\tconst result = iterator.next();\n\t\t\tif (result.done) {\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\n\t\t\tnextItem = result.value;\n\t\t\tnextItemTaken = true;\n\t\t\treturn { done: false, value: separator };\n\t\t}\n\n\t\tstarted = true;\n\t\treturn iterator.next();\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isEmpty.ts"],"names":[],"mappings":";;;AAuBO,SAAS,QAA2B,QAAoD,EAAA;AAC9F,EAAA,OAAO,IAAK,CAAA,QAAQ,CAAE,CAAA,IAAA,GAAO,IAAQ,IAAA,KAAA;AACtC;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"isEmpty.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Advances the iterable once, returning `true` if it's exhausted and `false` otherwise.\n *\n * @param iterable The iterator to check for emptiness.\n * @returns `true` if the iterator is empty; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { isEmpty } from '@sapphire/iterator-utilities';\n *\n * console.log(isEmpty([]));\n * // Output: true\n *\n * console.log(isEmpty([1, 2, 3, 4, 5]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function isEmpty<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn from(iterable).next().done ?? false;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isEmpty.ts"],"names":[],"mappings":";;;AAuBO,SAAS,QAA2B,QAAA,EAAoD;AAC9F,EAAA,OAAO,IAAA,CAAK,QAAQ,CAAA,CAAE,IAAA,GAAO,IAAA,IAAQ,KAAA;AACtC;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"isEmpty.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Advances the iterable once, returning `true` if it's exhausted and `false` otherwise.\n *\n * @param iterable The iterator to check for emptiness.\n * @returns `true` if the iterator is empty; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { isEmpty } from '@sapphire/iterator-utilities';\n *\n * console.log(isEmpty([]));\n * // Output: true\n *\n * console.log(isEmpty([1, 2, 3, 4, 5]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function isEmpty<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn from(iterable).next().done ?? false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isSorted.ts"],"names":[],"mappings":";;;;AAmCO,SAAS,SAA4B,QAAoD,EAAA;AAC/F,EAAO,OAAA,UAAA,CAAW,UAAU,cAAc,CAAA;AAC3C;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"isSorted.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { isSortedBy } from './isSortedBy';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Checks if the elements of this iterator are sorted in ascending order.\n *\n * That is, for each element `a` and its following element `b`, `a <= b` must hold. If the iterator yields exactly zero\n * or one element, `true` is returned.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link isSortedBy} instead.\n *\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { isSorted } from '@sapphire/iterator-utilities';\n *\n * assert(isSorted([1, 2, 2, 9]);\n * assert(!isSorted([1, 3, 2, 4]);\n *\n * assert(isSorted([0]);\n * assert(isSorted([]);\n * assert(isSorted([0, 1, NaN]);\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSorted<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn isSortedBy(iterable, defaultCompare);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isSorted.ts"],"names":[],"mappings":";;;;AAmCO,SAAS,SAA4B,QAAA,EAAoD;AAC/F,EAAA,OAAO,UAAA,CAAW,UAAU,cAAc,CAAA;AAC3C;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"isSorted.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { isSortedBy } from './isSortedBy';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Checks if the elements of this iterator are sorted in ascending order.\n *\n * That is, for each element `a` and its following element `b`, `a <= b` must hold. If the iterator yields exactly zero\n * or one element, `true` is returned.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link isSortedBy} instead.\n *\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { isSorted } from '@sapphire/iterator-utilities';\n *\n * assert(isSorted([1, 2, 2, 9]);\n * assert(!isSorted([1, 3, 2, 4]);\n *\n * assert(isSorted([0]);\n * assert(isSorted([]);\n * assert(isSorted([0, 1, NaN]);\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSorted<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn isSortedBy(iterable, defaultCompare);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isSortedBy.ts"],"names":[],"mappings":";;;;;AAiCO,SAAS,UAAA,CAA8B,UAA2C,UAAuD,EAAA;AAC/I,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,EAAI,IAAA,MAAA,CAAO,MAAa,OAAA,IAAA;AAExB,EAAA,IAAI,WAAW,MAAO,CAAA,KAAA;AACtB,EAAA,KAAA,MAAW,WAAW,QAAU,EAAA;AAC/B,IAAA,MAAM,UAAa,GAAA,uBAAA,CAAqC,QAAU,EAAA,OAAA,EAAS,UAAU,CAAA;AACrF,IAAI,IAAA,iBAAA,CAAkB,UAAU,CAAA,EAAU,OAAA,KAAA;AAE1C,IAAW,QAAA,GAAA,OAAA;AAAA;AAGZ,EAAO,OAAA,IAAA;AACR;AAhBgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"isSortedBy.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given comparator function.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { ascNumber, isSortedBy } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedBy([1, 2, 2, 9], ascNumber));\n * assert(!isSortedBy([1, 2, 2, 9], ascNumber));\n *\n * assert(isSortedBy([0], () => true));\n * assert(isSortedBy([0], () => false));\n *\n * assert(isSortedBy([], () => true));\n * assert(isSortedBy([], () => false));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedBy<const ElementType>(iterable: IterableResolvable<ElementType>, comparator: CompareByComparator<ElementType>): boolean {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previous = result.value;\n\tfor (const current of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(previous, current, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tprevious = current;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isSortedBy.ts"],"names":[],"mappings":";;;;;AAiCO,SAAS,UAAA,CAA8B,UAA2C,UAAA,EAAuD;AAC/I,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,EAAA,IAAI,MAAA,CAAO,MAAM,OAAO,IAAA;AAExB,EAAA,IAAI,WAAW,MAAA,CAAO,KAAA;AACtB,EAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC/B,IAAA,MAAM,UAAA,GAAa,uBAAA,CAAqC,QAAA,EAAU,OAAA,EAAS,UAAU,CAAA;AACrF,IAAA,IAAI,iBAAA,CAAkB,UAAU,CAAA,EAAG,OAAO,KAAA;AAE1C,IAAA,QAAA,GAAW,OAAA;AAAA,EACZ;AAEA,EAAA,OAAO,IAAA;AACR;AAhBgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"isSortedBy.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given comparator function.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { ascNumber, isSortedBy } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedBy([1, 2, 2, 9], ascNumber));\n * assert(!isSortedBy([1, 2, 2, 9], ascNumber));\n *\n * assert(isSortedBy([0], () => true));\n * assert(isSortedBy([0], () => false));\n *\n * assert(isSortedBy([], () => true));\n * assert(isSortedBy([], () => false));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedBy<const ElementType>(iterable: IterableResolvable<ElementType>, comparator: CompareByComparator<ElementType>): boolean {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previous = result.value;\n\tfor (const current of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(previous, current, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tprevious = current;\n\t}\n\n\treturn true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isSortedByKey.ts"],"names":[],"mappings":";;;;;;AAgCO,SAAS,aACf,CAAA,QAAA,EACA,UACA,EAAA,UAAA,GAA8C,cACpC,EAAA;AACV,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,EAAI,IAAA,MAAA,CAAO,MAAa,OAAA,IAAA;AAExB,EAAA,IAAI,WAAc,GAAA,UAAA,CAAW,MAAO,CAAA,KAAA,EAAO,CAAC,CAAA;AAC5C,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAA,KAAA,MAAW,WAAW,QAAU,EAAA;AAC/B,IAAM,MAAA,UAAA,GAAa,UAAW,CAAA,OAAA,EAAS,KAAO,EAAA,CAAA;AAC9C,IAAA,MAAM,UAAa,GAAA,uBAAA,CAAoC,WAAa,EAAA,UAAA,EAAY,UAAU,CAAA;AAC1F,IAAI,IAAA,iBAAA,CAAkB,UAAU,CAAA,EAAU,OAAA,KAAA;AAE1C,IAAc,WAAA,GAAA,UAAA;AAAA;AAGf,EAAO,OAAA,IAAA;AACR;AAtBgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"isSortedByKey.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedBy } from './isSortedBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given key extraction function.\n *\n * Instead of comparing the iterator's elements directly, this function compares the keys of the elements, as determined\n * by `callbackFn`. Apart from that, it's equivalent to {@link isSorted}; see its documentation for more information.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n *\n * @param iterable The iterator to compare.\n * @param callbackFn The function to extract the key from an element.\n *\n * @example\n * ```typescript\n * import { isSortedByKey } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedByKey(['c', 'bb', 'aaa'], (s) => s.length));\n * assert(!isSortedBy([-2, -1, 0, 3], (n) => Math.abs(n)));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (a: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previousKey = callbackFn(result.value, 0);\n\tlet index = 1;\n\tfor (const current of iterator) {\n\t\tconst currentKey = callbackFn(current, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(previousKey, currentKey, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tpreviousKey = currentKey;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isSortedByKey.ts"],"names":[],"mappings":";;;;;;AAgCO,SAAS,aAAA,CACf,QAAA,EACA,UAAA,EACA,UAAA,GAA8C,cAAA,EACpC;AACV,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,EAAA,IAAI,MAAA,CAAO,MAAM,OAAO,IAAA;AAExB,EAAA,IAAI,WAAA,GAAc,UAAA,CAAW,MAAA,CAAO,KAAA,EAAO,CAAC,CAAA;AAC5C,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC/B,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,OAAA,EAAS,KAAA,EAAO,CAAA;AAC9C,IAAA,MAAM,UAAA,GAAa,uBAAA,CAAoC,WAAA,EAAa,UAAA,EAAY,UAAU,CAAA;AAC1F,IAAA,IAAI,iBAAA,CAAkB,UAAU,CAAA,EAAG,OAAO,KAAA;AAE1C,IAAA,WAAA,GAAc,UAAA;AAAA,EACf;AAEA,EAAA,OAAO,IAAA;AACR;AAtBgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"isSortedByKey.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedBy } from './isSortedBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given key extraction function.\n *\n * Instead of comparing the iterator's elements directly, this function compares the keys of the elements, as determined\n * by `callbackFn`. Apart from that, it's equivalent to {@link isSorted}; see its documentation for more information.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n *\n * @param iterable The iterator to compare.\n * @param callbackFn The function to extract the key from an element.\n *\n * @example\n * ```typescript\n * import { isSortedByKey } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedByKey(['c', 'bb', 'aaa'], (s) => s.length));\n * assert(!isSortedBy([-2, -1, 0, 3], (n) => Math.abs(n)));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (a: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previousKey = callbackFn(result.value, 0);\n\tlet index = 1;\n\tfor (const current of iterator) {\n\t\tconst currentKey = callbackFn(current, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(previousKey, currentKey, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tpreviousKey = currentKey;\n\t}\n\n\treturn true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/last.ts"],"names":["last"],"mappings":";;;AAsBO,SAAS,KAAwB,QAAoE,EAAA;AAC3G,EAAIA,IAAAA,KAAAA;AACJ,EAAW,KAAA,MAAA,KAAA,IAAS,kBAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAAA,KAAO,GAAA,KAAA;AAAA;AAGR,EAAOA,OAAAA,KAAAA;AACR;AAPgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"last.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable until it's exhausted, returning the last element.\n *\n * @param iterable An iterator to return the last value of.\n * @returns The value at the last position in the source iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { last } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(last(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator to find the last value.\n */\nexport function last<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\tlet last: ElementType | undefined;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tlast = value;\n\t}\n\n\treturn last;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/last.ts"],"names":["last"],"mappings":";;;AAsBO,SAAS,KAAwB,QAAA,EAAoE;AAC3G,EAAA,IAAIA,KAAAA;AACJ,EAAA,KAAA,MAAW,KAAA,IAAS,kBAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,IAAAA,KAAAA,GAAO,KAAA;AAAA,EACR;AAEA,EAAA,OAAOA,KAAAA;AACR;AAPgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"last.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable until it's exhausted, returning the last element.\n *\n * @param iterable An iterator to return the last value of.\n * @returns The value at the last position in the source iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { last } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(last(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator to find the last value.\n */\nexport function last<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\tlet last: ElementType | undefined;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tlast = value;\n\t}\n\n\treturn last;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/lessOrEqualThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,eAAA,CAAmC,UAA2C,KAAiD,EAAA;AAC9I,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAO,OAAA,CAAC,kBAAkB,MAAM,CAAA;AACjC;AAHgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA","file":"lessOrEqualThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsGreater, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} less or equal than\n * those of another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { lessOrEqualThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(lessOrEqualThan([1], [1]));\n * // Output: false\n * console.log(lessOrEqualThan([1], [1, 2]));\n * // Output: true\n * console.log(lessOrEqualThan([1, 2], [1]));\n * // Output: false\n * console.log(lessOrEqualThan([1, 2], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function lessOrEqualThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn !orderingIsGreater(result);\n}\n\nexport { lessOrEqualThan as le };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/lessOrEqualThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,eAAA,CAAmC,UAA2C,KAAA,EAAiD;AAC9I,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,CAAC,kBAAkB,MAAM,CAAA;AACjC;AAHgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA","file":"lessOrEqualThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsGreater, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} less or equal than\n * those of another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { lessOrEqualThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(lessOrEqualThan([1], [1]));\n * // Output: false\n * console.log(lessOrEqualThan([1], [1, 2]));\n * // Output: true\n * console.log(lessOrEqualThan([1, 2], [1]));\n * // Output: false\n * console.log(lessOrEqualThan([1, 2], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function lessOrEqualThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn !orderingIsGreater(result);\n}\n\nexport { lessOrEqualThan as le };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/lessThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,QAAA,CAA4B,UAA2C,KAAiD,EAAA;AACvI,EAAM,MAAA,MAAA,GAAS,OAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,eAAe,MAAM,CAAA;AAC7B;AAHgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"lessThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsLess, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} less than those of\n * another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { lessThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(lessThan([1], [1]));\n * // Output: false\n * console.log(lessThan([1], [1, 2]));\n * // Output: true\n * console.log(lessThan([1, 2], [1]));\n * // Output: false\n * console.log(lessThan([1, 2], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function lessThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn orderingIsLess(result);\n}\n\nexport { lessThan as lt };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/lessThan.ts"],"names":[],"mappings":";;;;AA+BO,SAAS,QAAA,CAA4B,UAA2C,KAAA,EAAiD;AACvI,EAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,eAAe,MAAM,CAAA;AAC7B;AAHgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"lessThan.mjs","sourcesContent":["import { compare } from './compare';\nimport type { IterableResolvable } from './from';\nimport { orderingIsLess, type LexicographicComparison } from './shared/_compare';\n\n/**\n * Determines if the elements of `iterable` are {@link LexicographicComparison lexicographically} less than those of\n * another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { lessThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(lessThan([1], [1]));\n * // Output: false\n * console.log(lessThan([1], [1, 2]));\n * // Output: true\n * console.log(lessThan([1, 2], [1]));\n * // Output: false\n * console.log(lessThan([1, 2], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function lessThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn orderingIsLess(result);\n}\n\nexport { lessThan as lt };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/map.ts"],"names":[],"mappings":";;;;AAmBO,UAAU,GAAA,CAChB,UACA,UAC+B,EAAA;AAC/B,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAW,kBAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAM,MAAA,UAAA,CAAW,SAAS,KAAO,EAAA,CAAA;AAAA;AAEnC;AAViB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"map.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the results of calling a provided function on each element.\n *\n * @param iterable An iterator to map over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is yielded by the iterator helper.\n *\n * @example\n * ```typescript\n * import { map } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...map(iterable, (value) => value * 2)]);\n * // Output: [2, 4, 6, 8, 10]\n * ```\n */\nexport function* map<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield callbackFn(element, index++);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/map.ts"],"names":[],"mappings":";;;;AAmBO,UAAU,GAAA,CAChB,UACA,UAAA,EAC+B;AAC/B,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,OAAA,IAAW,kBAAA,CAAmB,QAAQ,CAAA,EAAG;AACnD,IAAA,MAAM,UAAA,CAAW,SAAS,KAAA,EAAO,CAAA;AAAA,EAClC;AACD;AAViB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"map.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the results of calling a provided function on each element.\n *\n * @param iterable An iterator to map over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is yielded by the iterator helper.\n *\n * @example\n * ```typescript\n * import { map } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...map(iterable, (value) => value * 2)]);\n * // Output: [2, 4, 6, 8, 10]\n * ```\n */\nexport function* map<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield callbackFn(element, index++);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/max.ts"],"names":[],"mappings":";;;;AA8BO,SAAS,IAAuB,QAA+D,EAAA;AACrG,EAAO,OAAA,KAAA,CAAM,UAAU,cAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"max.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { maxBy } from './maxBy';\nimport type { maxByKey } from './maxByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Consumes the iterable and returns the highest number element. If the iterable is empty, it returns `null`.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link maxBy} instead.\n *\n * @seealso {@link maxBy} for a version that allows custom comparators.\n * @seealso {@link maxByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @returns The maximum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { max } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(max(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function max<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | null {\n\treturn maxBy(iterable, defaultCompare);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/max.ts"],"names":[],"mappings":";;;;AA8BO,SAAS,IAAuB,QAAA,EAA+D;AACrG,EAAA,OAAO,KAAA,CAAM,UAAU,cAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"max.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { maxBy } from './maxBy';\nimport type { maxByKey } from './maxByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Consumes the iterable and returns the highest number element. If the iterable is empty, it returns `null`.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link maxBy} instead.\n *\n * @seealso {@link maxBy} for a version that allows custom comparators.\n * @seealso {@link maxByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @returns The maximum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { max } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(max(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function max<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | null {\n\treturn maxBy(iterable, defaultCompare);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/maxBy.ts"],"names":[],"mappings":";;;;;AAgCO,SAAS,KAAA,CACf,UACA,UACqB,EAAA;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,KAAA,GAAQ,SAAS,IAAK,EAAA;AAC5B,EAAI,IAAA,KAAA,CAAM,MAAa,OAAA,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAM,CAAA,KAAA;AACpB,EAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC7B,IAAA,MAAM,UAAa,GAAA,uBAAA,CAAqC,KAAO,EAAA,OAAA,EAAS,UAAU,CAAA;AAClF,IAAI,IAAA,CAAC,cAAe,CAAA,UAAU,CAAG,EAAA;AAChC,MAAU,OAAA,GAAA,KAAA;AAAA;AACX;AAGD,EAAO,OAAA,OAAA;AACR;AAnBgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"maxBy.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { max } from './max';\nimport type { maxByKey } from './maxByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsLess, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the maximum value with respect to the specified comparison function.\n *\n * If several elements are equally maximum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link max} for a version that uses the default comparator.\n * @seealso {@link maxByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @param comparator A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the maximum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { ascNumber, maxBy } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(maxBy(iterable, ascNumber));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function maxBy<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcomparator: CompareByComparator<ElementType>\n): ElementType | null {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet maximum = first.value;\n\tfor (const value of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(value, maximum, comparator);\n\t\tif (!orderingIsLess(comparison)) {\n\t\t\tmaximum = value;\n\t\t}\n\t}\n\n\treturn maximum;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/maxBy.ts"],"names":[],"mappings":";;;;;AAgCO,SAAS,KAAA,CACf,UACA,UAAA,EACqB;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,KAAA,GAAQ,SAAS,IAAA,EAAK;AAC5B,EAAA,IAAI,KAAA,CAAM,MAAM,OAAO,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAA,CAAM,KAAA;AACpB,EAAA,KAAA,MAAW,SAAS,QAAA,EAAU;AAC7B,IAAA,MAAM,UAAA,GAAa,uBAAA,CAAqC,KAAA,EAAO,OAAA,EAAS,UAAU,CAAA;AAClF,IAAA,IAAI,CAAC,cAAA,CAAe,UAAU,CAAA,EAAG;AAChC,MAAA,OAAA,GAAU,KAAA;AAAA,IACX;AAAA,EACD;AAEA,EAAA,OAAO,OAAA;AACR;AAnBgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"maxBy.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { max } from './max';\nimport type { maxByKey } from './maxByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsLess, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the maximum value with respect to the specified comparison function.\n *\n * If several elements are equally maximum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link max} for a version that uses the default comparator.\n * @seealso {@link maxByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @param comparator A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the maximum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { ascNumber, maxBy } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(maxBy(iterable, ascNumber));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function maxBy<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcomparator: CompareByComparator<ElementType>\n): ElementType | null {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet maximum = first.value;\n\tfor (const value of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(value, maximum, comparator);\n\t\tif (!orderingIsLess(comparison)) {\n\t\t\tmaximum = value;\n\t\t}\n\t}\n\n\treturn maximum;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/maxByKey.ts"],"names":[],"mappings":";;;;;;AAkCO,SAAS,QACf,CAAA,QAAA,EACA,UACA,EAAA,UAAA,GAA8C,cACzB,EAAA;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,KAAA,GAAQ,SAAS,IAAK,EAAA;AAC5B,EAAI,IAAA,KAAA,CAAM,MAAa,OAAA,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAM,CAAA,KAAA;AACpB,EAAI,IAAA,UAAA,GAAa,UAAW,CAAA,OAAA,EAAS,CAAC,CAAA;AACtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC7B,IAAM,MAAA,GAAA,GAAM,UAAW,CAAA,KAAA,EAAO,KAAO,EAAA,CAAA;AACrC,IAAA,MAAM,UAAa,GAAA,uBAAA,CAAoC,UAAY,EAAA,GAAA,EAAK,UAAU,CAAA;AAElF,IAAI,IAAA,CAAC,iBAAkB,CAAA,UAAU,CAAG,EAAA;AACnC,MAAU,OAAA,GAAA,KAAA;AACV,MAAa,UAAA,GAAA,GAAA;AAAA;AACd;AAGD,EAAO,OAAA,OAAA;AACR;AAzBgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"maxByKey.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { max } from './max';\nimport type { maxBy } from './maxBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the maximum value from the specified function.\n *\n * If several elements are equally maximum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link max} for a version that uses the default comparator.\n * @seealso {@link maxBy} for a version that allows custom comparators.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @param callbackFn A function to execute for each element produced by the iterator, producing a key to compare with.\n * @param comparator A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the maximum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { maxByKey } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(maxByKey(iterable, (value) => Math.abs(value)));\n * // Output: -10\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function maxByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): ElementType | null {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet maximum = first.value;\n\tlet maximumKey = callbackFn(maximum, 0);\n\tlet index = 1;\n\tfor (const value of iterator) {\n\t\tconst key = callbackFn(value, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(maximumKey, key, comparator);\n\n\t\tif (!orderingIsGreater(comparison)) {\n\t\t\tmaximum = value;\n\t\t\tmaximumKey = key;\n\t\t}\n\t}\n\n\treturn maximum;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/maxByKey.ts"],"names":[],"mappings":";;;;;;AAkCO,SAAS,QAAA,CACf,QAAA,EACA,UAAA,EACA,UAAA,GAA8C,cAAA,EACzB;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,KAAA,GAAQ,SAAS,IAAA,EAAK;AAC5B,EAAA,IAAI,KAAA,CAAM,MAAM,OAAO,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAA,CAAM,KAAA;AACpB,EAAA,IAAI,UAAA,GAAa,UAAA,CAAW,OAAA,EAAS,CAAC,CAAA;AACtC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,SAAS,QAAA,EAAU;AAC7B,IAAA,MAAM,GAAA,GAAM,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,CAAA;AACrC,IAAA,MAAM,UAAA,GAAa,uBAAA,CAAoC,UAAA,EAAY,GAAA,EAAK,UAAU,CAAA;AAElF,IAAA,IAAI,CAAC,iBAAA,CAAkB,UAAU,CAAA,EAAG;AACnC,MAAA,OAAA,GAAU,KAAA;AACV,MAAA,UAAA,GAAa,GAAA;AAAA,IACd;AAAA,EACD;AAEA,EAAA,OAAO,OAAA;AACR;AAzBgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"maxByKey.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { max } from './max';\nimport type { maxBy } from './maxBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the maximum value from the specified function.\n *\n * If several elements are equally maximum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link max} for a version that uses the default comparator.\n * @seealso {@link maxBy} for a version that allows custom comparators.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @param callbackFn A function to execute for each element produced by the iterator, producing a key to compare with.\n * @param comparator A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the maximum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { maxByKey } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(maxByKey(iterable, (value) => Math.abs(value)));\n * // Output: -10\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function maxByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): ElementType | null {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet maximum = first.value;\n\tlet maximumKey = callbackFn(maximum, 0);\n\tlet index = 1;\n\tfor (const value of iterator) {\n\t\tconst key = callbackFn(value, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(maximumKey, key, comparator);\n\n\t\tif (!orderingIsGreater(comparison)) {\n\t\t\tmaximum = value;\n\t\t\tmaximumKey = key;\n\t\t}\n\t}\n\n\treturn maximum;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/min.ts"],"names":[],"mappings":";;;;AA8BO,SAAS,IAAuB,QAA+D,EAAA;AACrG,EAAO,OAAA,KAAA,CAAM,UAAU,cAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"min.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { minBy } from './minBy';\nimport type { minByKey } from './minByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Consumes the iterable and returns the lowest number element. If the iterable is empty, it returns `null`.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link minBy} instead.\n *\n * @seealso {@link minBy} for a version that allows custom comparators.\n * @seealso {@link minByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @returns The minimum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { min } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(min(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function min<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | null {\n\treturn minBy(iterable, defaultCompare);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/min.ts"],"names":[],"mappings":";;;;AA8BO,SAAS,IAAuB,QAAA,EAA+D;AACrG,EAAA,OAAO,KAAA,CAAM,UAAU,cAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"min.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { minBy } from './minBy';\nimport type { minByKey } from './minByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Consumes the iterable and returns the lowest number element. If the iterable is empty, it returns `null`.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link minBy} instead.\n *\n * @seealso {@link minBy} for a version that allows custom comparators.\n * @seealso {@link minByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @returns The minimum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { min } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(min(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function min<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | null {\n\treturn minBy(iterable, defaultCompare);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/minBy.ts"],"names":[],"mappings":";;;;;AAgCO,SAAS,KAAA,CACf,UACA,UACqB,EAAA;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,KAAA,GAAQ,SAAS,IAAK,EAAA;AAC5B,EAAI,IAAA,KAAA,CAAM,MAAa,OAAA,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAM,CAAA,KAAA;AACpB,EAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC7B,IAAA,MAAM,UAAa,GAAA,uBAAA,CAAqC,KAAO,EAAA,OAAA,EAAS,UAAU,CAAA;AAElF,IAAI,IAAA,CAAC,iBAAkB,CAAA,UAAU,CAAG,EAAA;AACnC,MAAU,OAAA,GAAA,KAAA;AAAA;AACX;AAGD,EAAO,OAAA,OAAA;AACR;AApBgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"minBy.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { min } from './min';\nimport type { minByKey } from './minByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the minimum value with respect to the specified comparison function.\n *\n * If several elements are equally minimum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link min} for a version that uses the default comparator.\n * @seealso {@link minByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the minimum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { ascNumber, minBy } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(minBy(iterable, ascNumber));\n * // Output: -10\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function minBy<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcomparator: CompareByComparator<ElementType>\n): ElementType | null {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet minimum = first.value;\n\tfor (const value of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(value, minimum, comparator);\n\n\t\tif (!orderingIsGreater(comparison)) {\n\t\t\tminimum = value;\n\t\t}\n\t}\n\n\treturn minimum;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/minBy.ts"],"names":[],"mappings":";;;;;AAgCO,SAAS,KAAA,CACf,UACA,UAAA,EACqB;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,KAAA,GAAQ,SAAS,IAAA,EAAK;AAC5B,EAAA,IAAI,KAAA,CAAM,MAAM,OAAO,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAA,CAAM,KAAA;AACpB,EAAA,KAAA,MAAW,SAAS,QAAA,EAAU;AAC7B,IAAA,MAAM,UAAA,GAAa,uBAAA,CAAqC,KAAA,EAAO,OAAA,EAAS,UAAU,CAAA;AAElF,IAAA,IAAI,CAAC,iBAAA,CAAkB,UAAU,CAAA,EAAG;AACnC,MAAA,OAAA,GAAU,KAAA;AAAA,IACX;AAAA,EACD;AAEA,EAAA,OAAO,OAAA;AACR;AApBgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"minBy.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { min } from './min';\nimport type { minByKey } from './minByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the minimum value with respect to the specified comparison function.\n *\n * If several elements are equally minimum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link min} for a version that uses the default comparator.\n * @seealso {@link minByKey} for a version that allows custom key extractors.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the minimum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { ascNumber, minBy } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(minBy(iterable, ascNumber));\n * // Output: -10\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function minBy<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcomparator: CompareByComparator<ElementType>\n): ElementType | null {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet minimum = first.value;\n\tfor (const value of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(value, minimum, comparator);\n\n\t\tif (!orderingIsGreater(comparison)) {\n\t\t\tminimum = value;\n\t\t}\n\t}\n\n\treturn minimum;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/minByKey.ts"],"names":[],"mappings":";;;;;;AAiCO,SAAS,QACf,CAAA,QAAA,EACA,UACA,EAAA,UAAA,GAA8C,cACzB,EAAA;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,KAAA,GAAQ,SAAS,IAAK,EAAA;AAC5B,EAAI,IAAA,KAAA,CAAM,MAAa,OAAA,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAM,CAAA,KAAA;AACpB,EAAI,IAAA,UAAA,GAAa,UAAW,CAAA,OAAA,EAAS,CAAC,CAAA;AACtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAA,KAAA,MAAW,SAAS,QAAU,EAAA;AAC7B,IAAM,MAAA,GAAA,GAAM,UAAW,CAAA,KAAA,EAAO,KAAO,EAAA,CAAA;AACrC,IAAA,MAAM,UAAa,GAAA,uBAAA,CAAoC,UAAY,EAAA,GAAA,EAAK,UAAU,CAAA;AAElF,IAAI,IAAA,CAAC,cAAe,CAAA,UAAU,CAAG,EAAA;AAChC,MAAU,OAAA,GAAA,KAAA;AACV,MAAa,UAAA,GAAA,GAAA;AAAA;AACd;AAGD,EAAO,OAAA,OAAA;AACR;AAzBgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"minByKey.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { min } from './min';\nimport type { minBy } from './minBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsLess, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the minimum value from the specified function.\n *\n * If several elements are equally minimum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link min} for a version that uses the default comparator.\n * @seealso {@link minBy} for a version that allows custom comparators.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the minimum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { minByKey } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(minByKey(iterable, (value) => Math.abs(value)));\n * // Output: 0\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function minByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): ElementType | null {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet minimum = first.value;\n\tlet minimumKey = callbackFn(minimum, 0);\n\tlet index = 1;\n\tfor (const value of iterator) {\n\t\tconst key = callbackFn(value, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(minimumKey, key, comparator);\n\n\t\tif (!orderingIsLess(comparison)) {\n\t\t\tminimum = value;\n\t\t\tminimumKey = key;\n\t\t}\n\t}\n\n\treturn minimum;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/minByKey.ts"],"names":[],"mappings":";;;;;;AAiCO,SAAS,QAAA,CACf,QAAA,EACA,UAAA,EACA,UAAA,GAA8C,cAAA,EACzB;AACrB,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAW,mBAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,KAAA,GAAQ,SAAS,IAAA,EAAK;AAC5B,EAAA,IAAI,KAAA,CAAM,MAAM,OAAO,IAAA;AAEvB,EAAA,IAAI,UAAU,KAAA,CAAM,KAAA;AACpB,EAAA,IAAI,UAAA,GAAa,UAAA,CAAW,OAAA,EAAS,CAAC,CAAA;AACtC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,SAAS,QAAA,EAAU;AAC7B,IAAA,MAAM,GAAA,GAAM,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,CAAA;AACrC,IAAA,MAAM,UAAA,GAAa,uBAAA,CAAoC,UAAA,EAAY,GAAA,EAAK,UAAU,CAAA;AAElF,IAAA,IAAI,CAAC,cAAA,CAAe,UAAU,CAAA,EAAG;AAChC,MAAA,OAAA,GAAU,KAAA;AACV,MAAA,UAAA,GAAa,GAAA;AAAA,IACd;AAAA,EACD;AAEA,EAAA,OAAO,OAAA;AACR;AAzBgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"minByKey.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { min } from './min';\nimport type { minBy } from './minBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsLess, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Returns the element that gives the minimum value from the specified function.\n *\n * If several elements are equally minimum, the last element is returned. If the iterator is empty, `null` is returned.\n *\n * @seealso {@link min} for a version that uses the default comparator.\n * @seealso {@link minBy} for a version that allows custom comparators.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a number value.\n * @returns The element that gives the minimum value from the specified function, or `null` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { minByKey } from '@sapphire/iterator-utilities';\n *\n * const iterable = [-3, 0, 1, 5, -10];\n * console.log(minByKey(iterable, (value) => Math.abs(value)));\n * // Output: 0\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function minByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): ElementType | null {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst first = iterator.next();\n\tif (first.done) return null;\n\n\tlet minimum = first.value;\n\tlet minimumKey = callbackFn(minimum, 0);\n\tlet index = 1;\n\tfor (const value of iterator) {\n\t\tconst key = callbackFn(value, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(minimumKey, key, comparator);\n\n\t\tif (!orderingIsLess(comparison)) {\n\t\t\tminimum = value;\n\t\t\tminimumKey = key;\n\t\t}\n\t}\n\n\treturn minimum;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/notEqual.ts"],"names":[],"mappings":";;;AAwBO,SAAS,QAAA,CAA4B,UAA2C,KAAiD,EAAA;AACvI,EAAO,OAAA,CAAC,KAAM,CAAA,QAAA,EAAU,KAAK,CAAA;AAC9B;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"notEqual.mjs","sourcesContent":["import { equal } from './equal';\nimport type { IterableResolvable } from './from';\n\n/**\n * Determines if the elements of both iterators are not equal.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are not equal.\n *\n * @example\n * ```typescript\n * import { notEqual } from '@sapphire/iterator-utilities';\n *\n * console.log(notEqual([1], [1]));\n * // Output: false\n * console.log(notEqual([1], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function notEqual<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\treturn !equal(iterable, other);\n}\n\nexport { notEqual as ne };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/notEqual.ts"],"names":[],"mappings":";;;AAwBO,SAAS,QAAA,CAA4B,UAA2C,KAAA,EAAiD;AACvI,EAAA,OAAO,CAAC,KAAA,CAAM,QAAA,EAAU,KAAK,CAAA;AAC9B;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"notEqual.mjs","sourcesContent":["import { equal } from './equal';\nimport type { IterableResolvable } from './from';\n\n/**\n * Determines if the elements of both iterators are not equal.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are not equal.\n *\n * @example\n * ```typescript\n * import { notEqual } from '@sapphire/iterator-utilities';\n *\n * console.log(notEqual([1], [1]));\n * // Output: false\n * console.log(notEqual([1], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function notEqual<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\treturn !equal(iterable, other);\n}\n\nexport { notEqual as ne };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/partition.ts"],"names":[],"mappings":";;;;AAwCO,SAAS,SAAA,CACf,UACA,SACiC,EAAA;AACjC,EAAA,SAAA,GAAY,eAAe,SAAS,CAAA;AAEpC,EAAA,MAAM,aAA4B,EAAC;AACnC,EAAA,MAAM,cAA6B,EAAC;AAEpC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAAS,kBAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAI,IAAA,SAAA,CAAU,KAAO,EAAA,KAAA,EAAO,CAAG,EAAA;AAC9B,MAAA,UAAA,CAAW,KAAK,KAAK,CAAA;AAAA,KACf,MAAA;AACN,MAAA,WAAA,CAAY,KAAK,KAAK,CAAA;AAAA;AACvB;AAGD,EAAO,OAAA,CAAC,YAAY,WAAW,CAAA;AAChC;AAnBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"partition.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and creates two arrays, one with the elements that pass the test and another with the elements that don't.\n *\n * @param iterable An iterator to partition.\n * @param predicate A function that determines which partition an element belongs to.\n * @returns An array containing two iterators. The first iterator contains elements that satisfy the predicate, and the\n * second iterator contains elements that do not.\n *\n * @example\n * ```typescript\n * import { partition } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [even, odd] = partition(iterable, (value) => value % 2 === 0);\n *\n * console.log(even);\n * // Output: [2, 4]\n *\n * console.log(odd);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into two arrays based on the predicate before returning\n * them, which may not be desirable for large iterators.\n */\nexport function partition<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => value is FilteredType\n): [FilteredType[], Exclude<ElementType, FilteredType>[]];\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]];\n\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]] {\n\tpredicate = assertFunction(predicate);\n\n\tconst bufferLeft: ElementType[] = [];\n\tconst bufferRight: ElementType[] = [];\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (predicate(value, index++)) {\n\t\t\tbufferLeft.push(value);\n\t\t} else {\n\t\t\tbufferRight.push(value);\n\t\t}\n\t}\n\n\treturn [bufferLeft, bufferRight];\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/partition.ts"],"names":[],"mappings":";;;;AAwCO,SAAS,SAAA,CACf,UACA,SAAA,EACiC;AACjC,EAAA,SAAA,GAAY,eAAe,SAAS,CAAA;AAEpC,EAAA,MAAM,aAA4B,EAAC;AACnC,EAAA,MAAM,cAA6B,EAAC;AAEpC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,KAAA,IAAS,kBAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,IAAA,IAAI,SAAA,CAAU,KAAA,EAAO,KAAA,EAAO,CAAA,EAAG;AAC9B,MAAA,UAAA,CAAW,KAAK,KAAK,CAAA;AAAA,IACtB,CAAA,MAAO;AACN,MAAA,WAAA,CAAY,KAAK,KAAK,CAAA;AAAA,IACvB;AAAA,EACD;AAEA,EAAA,OAAO,CAAC,YAAY,WAAW,CAAA;AAChC;AAnBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"partition.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and creates two arrays, one with the elements that pass the test and another with the elements that don't.\n *\n * @param iterable An iterator to partition.\n * @param predicate A function that determines which partition an element belongs to.\n * @returns An array containing two iterators. The first iterator contains elements that satisfy the predicate, and the\n * second iterator contains elements that do not.\n *\n * @example\n * ```typescript\n * import { partition } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [even, odd] = partition(iterable, (value) => value % 2 === 0);\n *\n * console.log(even);\n * // Output: [2, 4]\n *\n * console.log(odd);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into two arrays based on the predicate before returning\n * them, which may not be desirable for large iterators.\n */\nexport function partition<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => value is FilteredType\n): [FilteredType[], Exclude<ElementType, FilteredType>[]];\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]];\n\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]] {\n\tpredicate = assertFunction(predicate);\n\n\tconst bufferLeft: ElementType[] = [];\n\tconst bufferRight: ElementType[] = [];\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (predicate(value, index++)) {\n\t\t\tbufferLeft.push(value);\n\t\t} else {\n\t\t\tbufferRight.push(value);\n\t\t}\n\t}\n\n\treturn [bufferLeft, bufferRight];\n}\n"]}
@@ -8,7 +8,7 @@ function peekable(iterable) {
8
8
  next() {
9
9
  if (peeked) {
10
10
  const value = peeked;
11
- peeked = undefined;
11
+ peeked = void 0;
12
12
  return value;
13
13
  }
14
14
  return resolvedIterable.next();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/peekable.ts"],"names":[],"mappings":";;;AA6BO,SAAS,SAA4B,QAAkE,EAAA;AAC7G,EAAM,MAAA,gBAAA,GAAmB,KAAK,QAAQ,CAAA;AACtC,EAAI,IAAA,MAAA;AACJ,EAAO,OAAA;AAAA,IACN,IAAO,GAAA;AACN,MAAA,IAAI,MAAQ,EAAA;AACX,QAAA,MAAM,KAAQ,GAAA,MAAA;AACd,QAAS,MAAA,GAAA,SAAA;AACT,QAAO,OAAA,KAAA;AAAA;AAGR,MAAA,OAAO,iBAAiB,IAAK,EAAA;AAAA,KAC9B;AAAA,IACA,IAAO,GAAA;AACN,MAAQ,OAAA,MAAA,KAAW,iBAAiB,IAAK,EAAA;AAAA,KAC1C;AAAA,IACA,CAAC,MAAO,CAAA,QAAQ,CAAI,GAAA;AACnB,MAAO,OAAA,IAAA;AAAA;AACR,GACD;AACD;AApBgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"peekable.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Creates an iterator that allows you to peek at the next element without advancing the iterator.\n *\n * @template ElementType The type of elements in the iterable.\n * @param iterable The iterable to create a peekable iterator from.\n * @returns A new peekable iterator.\n *\n * @example\n * ```typescript\n * import { peekable } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const peekableIterator = peekable(iterable);\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 1, done: false }\n *\n * console.log(peekableIterator.peek());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 3, done: false }\n * ```\n */\nexport function peekable<const ElementType>(iterable: IterableResolvable<ElementType>): Peekable<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tlet peeked: IteratorResult<ElementType> | undefined;\n\treturn {\n\t\tnext() {\n\t\t\tif (peeked) {\n\t\t\t\tconst value = peeked;\n\t\t\t\tpeeked = undefined;\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\treturn resolvedIterable.next();\n\t\t},\n\t\tpeek() {\n\t\t\treturn (peeked ??= resolvedIterable.next());\n\t\t},\n\t\t[Symbol.iterator]() {\n\t\t\treturn this as IterableIterator<ElementType>;\n\t\t}\n\t};\n}\n\nexport interface Peekable<T> extends IterableIterator<T> {\n\tpeek(): IteratorResult<T>;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/peekable.ts"],"names":[],"mappings":";;;AA6BO,SAAS,SAA4B,QAAA,EAAkE;AAC7G,EAAA,MAAM,gBAAA,GAAmB,KAAK,QAAQ,CAAA;AACtC,EAAA,IAAI,MAAA;AACJ,EAAA,OAAO;AAAA,IACN,IAAA,GAAO;AACN,MAAA,IAAI,MAAA,EAAQ;AACX,QAAA,MAAM,KAAA,GAAQ,MAAA;AACd,QAAA,MAAA,GAAS,MAAA;AACT,QAAA,OAAO,KAAA;AAAA,MACR;AAEA,MAAA,OAAO,iBAAiB,IAAA,EAAK;AAAA,IAC9B,CAAA;AAAA,IACA,IAAA,GAAO;AACN,MAAA,OAAQ,MAAA,KAAW,iBAAiB,IAAA,EAAK;AAAA,IAC1C,CAAA;AAAA,IACA,CAAC,MAAA,CAAO,QAAQ,CAAA,GAAI;AACnB,MAAA,OAAO,IAAA;AAAA,IACR;AAAA,GACD;AACD;AApBgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"peekable.mjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Creates an iterator that allows you to peek at the next element without advancing the iterator.\n *\n * @template ElementType The type of elements in the iterable.\n * @param iterable The iterable to create a peekable iterator from.\n * @returns A new peekable iterator.\n *\n * @example\n * ```typescript\n * import { peekable } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const peekableIterator = peekable(iterable);\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 1, done: false }\n *\n * console.log(peekableIterator.peek());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 3, done: false }\n * ```\n */\nexport function peekable<const ElementType>(iterable: IterableResolvable<ElementType>): Peekable<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tlet peeked: IteratorResult<ElementType> | undefined;\n\treturn {\n\t\tnext() {\n\t\t\tif (peeked) {\n\t\t\t\tconst value = peeked;\n\t\t\t\tpeeked = undefined;\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\treturn resolvedIterable.next();\n\t\t},\n\t\tpeek() {\n\t\t\treturn (peeked ??= resolvedIterable.next());\n\t\t},\n\t\t[Symbol.iterator]() {\n\t\t\treturn this as IterableIterator<ElementType>;\n\t\t}\n\t};\n}\n\nexport interface Peekable<T> extends IterableIterator<T> {\n\tpeek(): IteratorResult<T>;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/prepend.ts"],"names":["iterable"],"mappings":";;;AAoBO,UAAU,OAAA,CAChB,aACG,SAC6B,EAAA;AAChC,EAAA,KAAA,MAAWA,aAAY,SAAW,EAAA;AACjC,IAAA,OAAO,mBAAmBA,SAAQ,CAAA;AAAA;AAGnC,EAAA,OAAO,mBAAmB,QAAQ,CAAA;AACnC;AATiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"prepend.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterator with the provided iterables prepended to the first iterable.\n *\n * @param iterable The iterator to prepend values to.\n * @param iterables The iterables to prepend to the iterator.\n * @returns An iterator that yields the values of the provided iterator followed by the values of the provided iterables.\n *\n * @example\n * ```typescript\n * import { prepend } from '@sapphire/iterator-utilities';\n *\n * console.log([...prepend([3, 4, 5], [1, 2])]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @seealso {@link append} to append values to the end of an iterator.\n */\nexport function* prepend<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\t...iterables: IterableResolvable<ElementType>[]\n): IterableIterator<ElementType> {\n\tfor (const iterable of iterables) {\n\t\tyield* toIterableIterator(iterable);\n\t}\n\n\tyield* toIterableIterator(iterable);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/prepend.ts"],"names":["iterable"],"mappings":";;;AAoBO,UAAU,OAAA,CAChB,aACG,SAAA,EAC6B;AAChC,EAAA,KAAA,MAAWA,aAAY,SAAA,EAAW;AACjC,IAAA,OAAO,mBAAmBA,SAAQ,CAAA;AAAA,EACnC;AAEA,EAAA,OAAO,mBAAmB,QAAQ,CAAA;AACnC;AATiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"prepend.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterator with the provided iterables prepended to the first iterable.\n *\n * @param iterable The iterator to prepend values to.\n * @param iterables The iterables to prepend to the iterator.\n * @returns An iterator that yields the values of the provided iterator followed by the values of the provided iterables.\n *\n * @example\n * ```typescript\n * import { prepend } from '@sapphire/iterator-utilities';\n *\n * console.log([...prepend([3, 4, 5], [1, 2])]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @seealso {@link append} to append values to the end of an iterator.\n */\nexport function* prepend<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\t...iterables: IterableResolvable<ElementType>[]\n): IterableIterator<ElementType> {\n\tfor (const iterable of iterables) {\n\t\tyield* toIterableIterator(iterable);\n\t}\n\n\tyield* toIterableIterator(iterable);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/product.ts"],"names":[],"mappings":";;;;AAuBO,SAAS,QAAQ,QAA8C,EAAA;AACrE,EAAA,IAAI,MAAS,GAAA,CAAA;AACb,EAAA,KAAA,MAAW,KAAS,IAAA,GAAA,CAAI,QAAU,EAAA,eAAe,CAAG,EAAA;AACnD,IAAU,MAAA,IAAA,KAAA;AAAA;AAGX,EAAO,OAAA,MAAA;AACR;AAPgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"product.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the product of all the elements. If the iterable is empty, it returns `1`.\n *\n * @param iterable An iterator to calculate the product of.\n * @returns The product of the elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { product } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(product(iterable));\n * // Output: 120\n *\n * const iterable = [1, 2, 3, 4, 5, 0];\n * console.log(product(iterable));\n * // Output: 0\n * ```\n */\nexport function product(iterable: IterableResolvable<number>): number {\n\tlet result = 1;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tresult *= value;\n\t}\n\n\treturn result;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/product.ts"],"names":[],"mappings":";;;;AAuBO,SAAS,QAAQ,QAAA,EAA8C;AACrE,EAAA,IAAI,MAAA,GAAS,CAAA;AACb,EAAA,KAAA,MAAW,KAAA,IAAS,GAAA,CAAI,QAAA,EAAU,eAAe,CAAA,EAAG;AACnD,IAAA,MAAA,IAAU,KAAA;AAAA,EACX;AAEA,EAAA,OAAO,MAAA;AACR;AAPgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"product.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the product of all the elements. If the iterable is empty, it returns `1`.\n *\n * @param iterable An iterator to calculate the product of.\n * @returns The product of the elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { product } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(product(iterable));\n * // Output: 120\n *\n * const iterable = [1, 2, 3, 4, 5, 0];\n * console.log(product(iterable));\n * // Output: 0\n * ```\n */\nexport function product(iterable: IterableResolvable<number>): number {\n\tlet result = 1;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tresult *= value;\n\t}\n\n\treturn result;\n}\n"]}
@@ -4,7 +4,7 @@ import { toNumberOrThrow } from './shared/_toNumberOrThrow.mjs';
4
4
  function* range(start, end, step) {
5
5
  start = toNumberOrThrow(start);
6
6
  end = toNumberOrThrow(end);
7
- if (step === undefined) {
7
+ if (step === void 0) {
8
8
  step = start < end ? 1 : -1;
9
9
  } else {
10
10
  step = toNumberOrThrow(step);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/range.ts"],"names":[],"mappings":";;;AAgCO,UAAU,KAAA,CAAM,KAAe,EAAA,GAAA,EAAa,IAAqD,EAAA;AACvG,EAAA,KAAA,GAAQ,gBAAgB,KAAK,CAAA;AAC7B,EAAA,GAAA,GAAM,gBAAgB,GAAG,CAAA;AAEzB,EAAA,IAAI,SAAS,SAAW,EAAA;AACvB,IAAO,IAAA,GAAA,KAAA,GAAQ,MAAM,CAAI,GAAA,EAAA;AAAA,GACnB,MAAA;AACN,IAAA,IAAA,GAAO,gBAAgB,IAAI,CAAA;AAG3B,IAAA,IAAI,SAAS,CAAG,EAAA;AACf,MAAM,MAAA,IAAI,WAAW,qBAAqB,CAAA;AAAA;AAI3C,IAAI,IAAA,IAAA,GAAO,CAAK,IAAA,KAAA,GAAQ,GAAK,EAAA;AAC5B,MAAM,MAAA,IAAI,WAAW,mDAAmD,CAAA;AAAA,KAC9D,MAAA,IAAA,IAAA,GAAO,CAAK,IAAA,KAAA,GAAQ,GAAK,EAAA;AACnC,MAAM,MAAA,IAAI,WAAW,sDAAsD,CAAA;AAAA;AAC5E;AAGD,EAAA,IAAI,QAAQ,GAAK,EAAA;AAChB,IAAA,KAAA,IAAS,CAAI,GAAA,KAAA,EAAO,CAAI,GAAA,GAAA,EAAK,KAAK,IAAM,EAAA;AACvC,MAAM,MAAA,CAAA;AAAA;AACP,GACM,MAAA;AACN,IAAA,KAAA,IAAS,CAAI,GAAA,KAAA,EAAO,CAAI,GAAA,GAAA,EAAK,KAAK,IAAM,EAAA;AACvC,MAAM,MAAA,CAAA;AAAA;AACP;AAEF;AA/BiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"range.mjs","sourcesContent":["import { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable with the numbers from `start` to `stop` (exclusive) with an optional step.\n *\n * @param start The value of the first number in the range.\n * @param end The end value of the range.\n * @param step The amount to increment the range by.\n *\n * @example\n * ```typescript\n * import { range } from '@sapphire/iterator-utilities';\n *\n * const iterable = range(0, 5);\n * console.log([...iterable]);\n * // Output: [0, 1, 2, 3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(5, 0);\n * console.log([...iterable]);\n * // Output: [5, 4, 3, 2, 1]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(0, 5, 2);\n * console.log([...iterable]);\n * // Output: [0, 2, 4]\n * ```\n */\nexport function* range(start: number, end: number, step?: number | undefined): IterableIterator<number> {\n\tstart = toNumberOrThrow(start);\n\tend = toNumberOrThrow(end);\n\n\tif (step === undefined) {\n\t\tstep = start < end ? 1 : -1;\n\t} else {\n\t\tstep = toNumberOrThrow(step);\n\n\t\t// Prevent infinite loops.\n\t\tif (step === 0) {\n\t\t\tthrow new RangeError('Step cannot be zero');\n\t\t}\n\n\t\t// If the step is positive, the start must be less than the end.\n\t\tif (step > 0 && start > end) {\n\t\t\tthrow new RangeError('Start must be less than end when step is positive');\n\t\t} else if (step < 0 && start < end) {\n\t\t\tthrow new RangeError('Start must be greater than end when step is negative');\n\t\t}\n\t}\n\n\tif (start < end) {\n\t\tfor (let i = start; i < end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t} else {\n\t\tfor (let i = start; i > end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/range.ts"],"names":[],"mappings":";;;AAgCO,UAAU,KAAA,CAAM,KAAA,EAAe,GAAA,EAAa,IAAA,EAAqD;AACvG,EAAA,KAAA,GAAQ,gBAAgB,KAAK,CAAA;AAC7B,EAAA,GAAA,GAAM,gBAAgB,GAAG,CAAA;AAEzB,EAAA,IAAI,SAAS,MAAA,EAAW;AACvB,IAAA,IAAA,GAAO,KAAA,GAAQ,MAAM,CAAA,GAAI,EAAA;AAAA,EAC1B,CAAA,MAAO;AACN,IAAA,IAAA,GAAO,gBAAgB,IAAI,CAAA;AAG3B,IAAA,IAAI,SAAS,CAAA,EAAG;AACf,MAAA,MAAM,IAAI,WAAW,qBAAqB,CAAA;AAAA,IAC3C;AAGA,IAAA,IAAI,IAAA,GAAO,CAAA,IAAK,KAAA,GAAQ,GAAA,EAAK;AAC5B,MAAA,MAAM,IAAI,WAAW,mDAAmD,CAAA;AAAA,IACzE,CAAA,MAAA,IAAW,IAAA,GAAO,CAAA,IAAK,KAAA,GAAQ,GAAA,EAAK;AACnC,MAAA,MAAM,IAAI,WAAW,sDAAsD,CAAA;AAAA,IAC5E;AAAA,EACD;AAEA,EAAA,IAAI,QAAQ,GAAA,EAAK;AAChB,IAAA,KAAA,IAAS,CAAA,GAAI,KAAA,EAAO,CAAA,GAAI,GAAA,EAAK,KAAK,IAAA,EAAM;AACvC,MAAA,MAAM,CAAA;AAAA,IACP;AAAA,EACD,CAAA,MAAO;AACN,IAAA,KAAA,IAAS,CAAA,GAAI,KAAA,EAAO,CAAA,GAAI,GAAA,EAAK,KAAK,IAAA,EAAM;AACvC,MAAA,MAAM,CAAA;AAAA,IACP;AAAA,EACD;AACD;AA/BiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"range.mjs","sourcesContent":["import { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable with the numbers from `start` to `stop` (exclusive) with an optional step.\n *\n * @param start The value of the first number in the range.\n * @param end The end value of the range.\n * @param step The amount to increment the range by.\n *\n * @example\n * ```typescript\n * import { range } from '@sapphire/iterator-utilities';\n *\n * const iterable = range(0, 5);\n * console.log([...iterable]);\n * // Output: [0, 1, 2, 3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(5, 0);\n * console.log([...iterable]);\n * // Output: [5, 4, 3, 2, 1]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(0, 5, 2);\n * console.log([...iterable]);\n * // Output: [0, 2, 4]\n * ```\n */\nexport function* range(start: number, end: number, step?: number | undefined): IterableIterator<number> {\n\tstart = toNumberOrThrow(start);\n\tend = toNumberOrThrow(end);\n\n\tif (step === undefined) {\n\t\tstep = start < end ? 1 : -1;\n\t} else {\n\t\tstep = toNumberOrThrow(step);\n\n\t\t// Prevent infinite loops.\n\t\tif (step === 0) {\n\t\t\tthrow new RangeError('Step cannot be zero');\n\t\t}\n\n\t\t// If the step is positive, the start must be less than the end.\n\t\tif (step > 0 && start > end) {\n\t\t\tthrow new RangeError('Start must be less than end when step is positive');\n\t\t} else if (step < 0 && start < end) {\n\t\t\tthrow new RangeError('Start must be greater than end when step is negative');\n\t\t}\n\t}\n\n\tif (start < end) {\n\t\tfor (let i = start; i < end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t} else {\n\t\tfor (let i = start; i > end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/reduce.ts"],"names":[],"mappings":";;;;AAgCO,SAAS,MAAA,CACf,QACA,EAAA,UAAA,EACA,YACa,EAAA;AACb,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAI,IAAA,KAAA;AACJ,EAAI,IAAA,WAAA;AACJ,EAAM,MAAA,gBAAA,GAAmB,mBAAmB,QAAQ,CAAA;AACpD,EAAI,IAAA,SAAA,CAAU,SAAS,CAAG,EAAA;AACzB,IAAM,MAAA,UAAA,GAAa,iBAAiB,IAAK,EAAA;AACzC,IAAA,IAAI,UAAW,CAAA,IAAA,EAAY,MAAA,IAAI,UAAU,gDAAgD,CAAA;AAEzF,IAAQ,KAAA,GAAA,CAAA;AACR,IAAA,WAAA,GAAc,UAAW,CAAA,KAAA;AAAA,GACnB,MAAA;AACN,IAAQ,KAAA,GAAA,CAAA;AACR,IAAc,WAAA,GAAA,YAAA;AAAA;AAGf,EAAA,KAAA,MAAW,SAAS,gBAAkB,EAAA;AACrC,IAAc,WAAA,GAAA,UAAA,CAAW,WAAa,EAAA,KAAA,EAAO,KAAO,EAAA,CAAA;AAAA;AAGrD,EAAO,OAAA,WAAA;AACR;AA1BgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"reduce.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and reduces it to the reducer function's result.\n *\n * @param iterable An iterator to reduce.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value becomes the value\n * of the `accumulator` parameter on the next invocation of `callbackFn`. For the last invocation, the return value\n * becomes the return value of `reduce()`.\n * @param initialValue A value to which `accumulator` is initialized the first time the callback is called. If\n * `initialValue` is specified, `callbackFn` starts executing with the first element as `currentValue`. If\n * `initialValue` is not specified, `accumulator` is initialized to the first element, and `callbackFn` starts executing\n * with the second element as `currentValue`. In this case, if the iterator is empty (so that there's no first value to\n * return as `accumulator`), an error is thrown.\n * @returns\n *\n * @example\n * ```typescript\n * import { reduce } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(reduce(iterable, (accumulator, currentValue) => accumulator + currentValue));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * If `initialValue` is not provided, the first element of the iterator is used as the initial value of `accumulator`,\n * consuming the first element.\n */\nexport function reduce<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (accumulator: MappedType, currentValue: ElementType, currentIndex: number) => MappedType,\n\tinitialValue?: MappedType\n): MappedType {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index: number;\n\tlet accumulator: MappedType;\n\tconst resolvedIterable = toIterableIterator(iterable);\n\tif (arguments.length < 3) {\n\t\tconst firstValue = resolvedIterable.next();\n\t\tif (firstValue.done) throw new TypeError('Reduce of empty iterator with no initial value');\n\n\t\tindex = 1;\n\t\taccumulator = firstValue.value! as MappedType;\n\t} else {\n\t\tindex = 0;\n\t\taccumulator = initialValue!;\n\t}\n\n\tfor (const value of resolvedIterable) {\n\t\taccumulator = callbackFn(accumulator, value, index++);\n\t}\n\n\treturn accumulator;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/reduce.ts"],"names":[],"mappings":";;;;AAgCO,SAAS,MAAA,CACf,QAAA,EACA,UAAA,EACA,YAAA,EACa;AACb,EAAA,UAAA,GAAa,eAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI,WAAA;AACJ,EAAA,MAAM,gBAAA,GAAmB,mBAAmB,QAAQ,CAAA;AACpD,EAAA,IAAI,SAAA,CAAU,SAAS,CAAA,EAAG;AACzB,IAAA,MAAM,UAAA,GAAa,iBAAiB,IAAA,EAAK;AACzC,IAAA,IAAI,UAAA,CAAW,IAAA,EAAM,MAAM,IAAI,UAAU,gDAAgD,CAAA;AAEzF,IAAA,KAAA,GAAQ,CAAA;AACR,IAAA,WAAA,GAAc,UAAA,CAAW,KAAA;AAAA,EAC1B,CAAA,MAAO;AACN,IAAA,KAAA,GAAQ,CAAA;AACR,IAAA,WAAA,GAAc,YAAA;AAAA,EACf;AAEA,EAAA,KAAA,MAAW,SAAS,gBAAA,EAAkB;AACrC,IAAA,WAAA,GAAc,UAAA,CAAW,WAAA,EAAa,KAAA,EAAO,KAAA,EAAO,CAAA;AAAA,EACrD;AAEA,EAAA,OAAO,WAAA;AACR;AA1BgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"reduce.mjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and reduces it to the reducer function's result.\n *\n * @param iterable An iterator to reduce.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value becomes the value\n * of the `accumulator` parameter on the next invocation of `callbackFn`. For the last invocation, the return value\n * becomes the return value of `reduce()`.\n * @param initialValue A value to which `accumulator` is initialized the first time the callback is called. If\n * `initialValue` is specified, `callbackFn` starts executing with the first element as `currentValue`. If\n * `initialValue` is not specified, `accumulator` is initialized to the first element, and `callbackFn` starts executing\n * with the second element as `currentValue`. In this case, if the iterator is empty (so that there's no first value to\n * return as `accumulator`), an error is thrown.\n * @returns\n *\n * @example\n * ```typescript\n * import { reduce } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(reduce(iterable, (accumulator, currentValue) => accumulator + currentValue));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * If `initialValue` is not provided, the first element of the iterator is used as the initial value of `accumulator`,\n * consuming the first element.\n */\nexport function reduce<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (accumulator: MappedType, currentValue: ElementType, currentIndex: number) => MappedType,\n\tinitialValue?: MappedType\n): MappedType {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index: number;\n\tlet accumulator: MappedType;\n\tconst resolvedIterable = toIterableIterator(iterable);\n\tif (arguments.length < 3) {\n\t\tconst firstValue = resolvedIterable.next();\n\t\tif (firstValue.done) throw new TypeError('Reduce of empty iterator with no initial value');\n\n\t\tindex = 1;\n\t\taccumulator = firstValue.value! as MappedType;\n\t} else {\n\t\tindex = 0;\n\t\taccumulator = initialValue!;\n\t}\n\n\tfor (const value of resolvedIterable) {\n\t\taccumulator = callbackFn(accumulator, value, index++);\n\t}\n\n\treturn accumulator;\n}\n"]}
@@ -7,7 +7,7 @@ function repeat(value, count) {
7
7
  count = assertNotNegative(toNumberOrThrow(count), count);
8
8
  let i = 0;
9
9
  return makeIterableIterator(
10
- () => i >= count ? { done: true, value: undefined } : (i++, { done: false, value })
10
+ () => i >= count ? { done: true, value: void 0 } : (i++, { done: false, value })
11
11
  );
12
12
  }
13
13
  __name(repeat, "repeat");
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/repeat.ts"],"names":[],"mappings":";;;;;AAqBO,SAAS,MAAA,CAA0B,OAAoB,KAA8C,EAAA;AAC3G,EAAA,KAAA,GAAQ,iBAAkB,CAAA,eAAA,CAAgB,KAAK,CAAA,EAAG,KAAK,CAAA;AAEvD,EAAA,IAAI,CAAI,GAAA,CAAA;AACR,EAAO,OAAA,oBAAA;AAAA,IAAkC,MACxC,CAAA,IAAK,KACF,GAAA,EAAE,IAAM,EAAA,IAAA,EAAM,KAAO,EAAA,SAAA,EACpB,IAAA,CAAA,EAAA,EAAK,EAAE,IAAA,EAAM,OAAO,KAAM,EAAA;AAAA,GAC/B;AACD;AATgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"repeat.mjs","sourcesContent":["import { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable that repeats the input iterable `count` times.\n *\n * @param value The value to be repeated.\n * @param count The number of times to repeat the value.\n *\n * @example\n * ```typescript\n * import { repeat } from '@sapphire/iterator-utilities';\n *\n * const iterator = repeat('Hello, world!', 3);\n * console.log([...iterator]);\n * // Output: ['Hello, world!', 'Hello, world!', 'Hello, world!']\n * ```\n *\n * @remarks This function does not clone `value`, it will be repeated as a reference.\n */\nexport function repeat<const ElementType>(value: ElementType, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toNumberOrThrow(count), count);\n\n\tlet i = 0;\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, { done: false, value })\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/repeat.ts"],"names":[],"mappings":";;;;;AAqBO,SAAS,MAAA,CAA0B,OAAoB,KAAA,EAA8C;AAC3G,EAAA,KAAA,GAAQ,iBAAA,CAAkB,eAAA,CAAgB,KAAK,CAAA,EAAG,KAAK,CAAA;AAEvD,EAAA,IAAI,CAAA,GAAI,CAAA;AACR,EAAA,OAAO,oBAAA;AAAA,IAAkC,MACxC,CAAA,IAAK,KAAA,GACF,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU,IAC9B,CAAA,EAAA,EAAK,EAAE,IAAA,EAAM,OAAO,KAAA,EAAM;AAAA,GAC/B;AACD;AATgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"repeat.mjs","sourcesContent":["import { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable that repeats the input iterable `count` times.\n *\n * @param value The value to be repeated.\n * @param count The number of times to repeat the value.\n *\n * @example\n * ```typescript\n * import { repeat } from '@sapphire/iterator-utilities';\n *\n * const iterator = repeat('Hello, world!', 3);\n * console.log([...iterator]);\n * // Output: ['Hello, world!', 'Hello, world!', 'Hello, world!']\n * ```\n *\n * @remarks This function does not clone `value`, it will be repeated as a reference.\n */\nexport function repeat<const ElementType>(value: ElementType, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toNumberOrThrow(count), count);\n\n\tlet i = 0;\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, { done: false, value })\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/reverse.ts"],"names":[],"mappings":";;;AAwBO,UAAU,QAA2B,QAA0E,EAAA;AACrH,EAAM,MAAA,KAAA,GAAQ,QAAQ,QAAQ,CAAA;AAC9B,EAAA,KAAA,IAAS,IAAI,KAAM,CAAA,MAAA,GAAS,CAAG,EAAA,CAAA,IAAK,GAAG,CAAK,EAAA,EAAA;AAC3C,IAAA,MAAM,MAAM,CAAC,CAAA;AAAA;AAEf;AALiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"reverse.mjs","sourcesContent":["import { collect } from './collect';\nimport type { IterableResolvable } from './from';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements in reverse order.\n *\n * @param iterable The iterator to reverse.\n * @returns An iterator whose element correspond to the elements of the provided iterator in reverse order.\n *\n * @example\n * ```typescript\n * import { reverse } from '@sapphire/iterator-utilities';\n *\n * console.log([...reverse([1, 2, 3, 4, 5])]);\n * // Output: [5, 4, 3, 2, 1]\n *\n * console.log([...reverse('hello')]);\n * // Output: ['o', 'l', 'l', 'e', 'h']\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into an array before yielding them in reverse order.\n */\nexport function* reverse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst items = collect(iterable);\n\tfor (let i = items.length - 1; i >= 0; i--) {\n\t\tyield items[i];\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/reverse.ts"],"names":[],"mappings":";;;AAwBO,UAAU,QAA2B,QAAA,EAA0E;AACrH,EAAA,MAAM,KAAA,GAAQ,QAAQ,QAAQ,CAAA;AAC9B,EAAA,KAAA,IAAS,IAAI,KAAA,CAAM,MAAA,GAAS,CAAA,EAAG,CAAA,IAAK,GAAG,CAAA,EAAA,EAAK;AAC3C,IAAA,MAAM,MAAM,CAAC,CAAA;AAAA,EACd;AACD;AALiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"reverse.mjs","sourcesContent":["import { collect } from './collect';\nimport type { IterableResolvable } from './from';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements in reverse order.\n *\n * @param iterable The iterator to reverse.\n * @returns An iterator whose element correspond to the elements of the provided iterator in reverse order.\n *\n * @example\n * ```typescript\n * import { reverse } from '@sapphire/iterator-utilities';\n *\n * console.log([...reverse([1, 2, 3, 4, 5])]);\n * // Output: [5, 4, 3, 2, 1]\n *\n * console.log([...reverse('hello')]);\n * // Output: ['o', 'l', 'l', 'e', 'h']\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into an array before yielding them in reverse order.\n */\nexport function* reverse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst items = collect(iterable);\n\tfor (let i = items.length - 1; i >= 0; i--) {\n\t\tyield items[i];\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_assertFunction.ts"],"names":[],"mappings":";;;AAAO,SAAS,eAAmD,KAAe,EAAA;AACjF,EAAI,IAAA,OAAO,UAAU,UAAY,EAAA;AAChC,IAAA,MAAM,IAAI,SAAA,CAAU,CAAG,EAAA,KAAK,CAAqB,mBAAA,CAAA,CAAA;AAAA;AAGlD,EAAO,OAAA,KAAA;AACR;AANgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA","file":"_assertFunction.mjs","sourcesContent":["export function assertFunction<Fn extends (...args: any[]) => any>(value: Fn): Fn {\n\tif (typeof value !== 'function') {\n\t\tthrow new TypeError(`${value} must be a function`);\n\t}\n\n\treturn value;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_assertFunction.ts"],"names":[],"mappings":";;;AAAO,SAAS,eAAmD,KAAA,EAAe;AACjF,EAAA,IAAI,OAAO,UAAU,UAAA,EAAY;AAChC,IAAA,MAAM,IAAI,SAAA,CAAU,CAAA,EAAG,KAAK,CAAA,mBAAA,CAAqB,CAAA;AAAA,EAClD;AAEA,EAAA,OAAO,KAAA;AACR;AANgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA","file":"_assertFunction.mjs","sourcesContent":["export function assertFunction<Fn extends (...args: any[]) => any>(value: Fn): Fn {\n\tif (typeof value !== 'function') {\n\t\tthrow new TypeError(`${value} must be a function`);\n\t}\n\n\treturn value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_assertNotNegative.ts"],"names":[],"mappings":";;;AAAO,SAAS,iBAAA,CAAkB,OAAe,QAA2B,EAAA;AAC3E,EAAA,IAAI,QAAQ,CAAG,EAAA;AACd,IAAA,MAAM,IAAI,UAAA,CAAW,CAAG,EAAA,QAAQ,CAAgC,8BAAA,CAAA,CAAA;AAAA;AAGjE,EAAO,OAAA,KAAA;AACR;AANgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA","file":"_assertNotNegative.mjs","sourcesContent":["export function assertNotNegative(value: number, original: unknown): number {\n\tif (value < 0) {\n\t\tthrow new RangeError(`${original} must be a non-negative number`);\n\t}\n\n\treturn value;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_assertNotNegative.ts"],"names":[],"mappings":";;;AAAO,SAAS,iBAAA,CAAkB,OAAe,QAAA,EAA2B;AAC3E,EAAA,IAAI,QAAQ,CAAA,EAAG;AACd,IAAA,MAAM,IAAI,UAAA,CAAW,CAAA,EAAG,QAAQ,CAAA,8BAAA,CAAgC,CAAA;AAAA,EACjE;AAEA,EAAA,OAAO,KAAA;AACR;AANgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA","file":"_assertNotNegative.mjs","sourcesContent":["export function assertNotNegative(value: number, original: unknown): number {\n\tif (value < 0) {\n\t\tthrow new RangeError(`${original} must be a non-negative number`);\n\t}\n\n\treturn value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_assertPositive.ts"],"names":[],"mappings":";;;AAAO,SAAS,cAAA,CAAe,OAAe,QAA2B,EAAA;AACxE,EAAA,IAAI,SAAS,CAAG,EAAA;AACf,IAAA,MAAM,IAAI,UAAA,CAAW,CAAG,EAAA,QAAQ,CAA4B,0BAAA,CAAA,CAAA;AAAA;AAG7D,EAAO,OAAA,KAAA;AACR;AANgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA","file":"_assertPositive.mjs","sourcesContent":["export function assertPositive(value: number, original: unknown): number {\n\tif (value <= 0) {\n\t\tthrow new RangeError(`${original} must be a positive number`);\n\t}\n\n\treturn value;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_assertPositive.ts"],"names":[],"mappings":";;;AAAO,SAAS,cAAA,CAAe,OAAe,QAAA,EAA2B;AACxE,EAAA,IAAI,SAAS,CAAA,EAAG;AACf,IAAA,MAAM,IAAI,UAAA,CAAW,CAAA,EAAG,QAAQ,CAAA,0BAAA,CAA4B,CAAA;AAAA,EAC7D;AAEA,EAAA,OAAO,KAAA;AACR;AANgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA","file":"_assertPositive.mjs","sourcesContent":["export function assertPositive(value: number, original: unknown): number {\n\tif (value <= 0) {\n\t\tthrow new RangeError(`${original} must be a positive number`);\n\t}\n\n\treturn value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_compare.ts"],"names":[],"mappings":";;;AAgBO,SAAS,uBAAA,CACf,CACA,EAAA,CAAA,EACA,UACS,EAAA;AAET,EAAI,IAAA,OAAO,MAAM,WAAa,EAAA;AAE7B,IAAI,IAAA,OAAO,CAAM,KAAA,WAAA,EAAoB,OAAA,CAAA;AAErC,IAAO,OAAA,CAAA;AAAA;AAGR,EAAI,IAAA,OAAO,MAAM,WAAa,EAAA;AAE7B,IAAO,OAAA,EAAA;AAAA;AAGR,EAAO,OAAA,UAAA,CAAW,GAAsC,CAAoC,CAAA;AAC7F;AAnBgB,MAAA,CAAA,uBAAA,EAAA,yBAAA,CAAA;AAqBT,SAAS,eAAe,QAAkB,EAAA;AAChD,EAAA,OAAO,QAAW,GAAA,CAAA;AACnB;AAFgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA;AAIT,SAAS,gBAAgB,QAAkB,EAAA;AACjD,EAAA,OAAO,QAAa,KAAA,CAAA;AACrB;AAFgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA;AAIT,SAAS,kBAAkB,QAAkB,EAAA;AACnD,EAAA,OAAO,QAAW,GAAA,CAAA;AACnB;AAFgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA","file":"_compare.mjs","sourcesContent":["/**\n * Represents the result of a lexicographic comparison.\n *\n * The operations are as follows:\n *\n * - Two iterators are compared element by element.\n * - The first pair of unequal elements determines the result.\n * - If one sequence is a prefix of the other, the shorter sequence is lexicographically less than the other.\n * - If two sequences have the same elements in the same order, they are lexicographically equal.\n * - An empty sequence is lexicographically less than any non-empty sequence.\n * - Two empty sequences are lexicographically equal.\n */\nexport type LexicographicComparison = -1 | 0 | 1;\n\nexport type CompareByComparator<ElementType> = (x: Exclude<ElementType, undefined>, y: Exclude<ElementType, undefined>) => number;\n\nexport function compareIteratorElements<const ElementType>(\n\tx: ElementType | undefined,\n\ty: ElementType | undefined,\n\tcomparator: CompareByComparator<ElementType>\n): number {\n\t// 23.1.3.30.2 CompareArrayElements (https://tc39.es/ecma262/#sec-comparearrayelements)\n\tif (typeof x === 'undefined') {\n\t\t// 1. If x and y are both `undefined`, return +0.\n\t\tif (typeof y === 'undefined') return 0;\n\t\t// 2. If x is `undefined`, return +1.\n\t\treturn 1;\n\t}\n\n\tif (typeof y === 'undefined') {\n\t\t// 3. If y is `undefined`, return -1.\n\t\treturn -1;\n\t}\n\n\treturn comparator(x as Exclude<ElementType, undefined>, y as Exclude<ElementType, undefined>);\n}\n\nexport function orderingIsLess(ordering: number) {\n\treturn ordering < 0;\n}\n\nexport function orderingIsEqual(ordering: number) {\n\treturn ordering === 0;\n}\n\nexport function orderingIsGreater(ordering: number) {\n\treturn ordering > 0;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_compare.ts"],"names":[],"mappings":";;;AAgBO,SAAS,uBAAA,CACf,CAAA,EACA,CAAA,EACA,UAAA,EACS;AAET,EAAA,IAAI,OAAO,MAAM,WAAA,EAAa;AAE7B,IAAA,IAAI,OAAO,CAAA,KAAM,WAAA,EAAa,OAAO,CAAA;AAErC,IAAA,OAAO,CAAA;AAAA,EACR;AAEA,EAAA,IAAI,OAAO,MAAM,WAAA,EAAa;AAE7B,IAAA,OAAO,EAAA;AAAA,EACR;AAEA,EAAA,OAAO,UAAA,CAAW,GAAsC,CAAoC,CAAA;AAC7F;AAnBgB,MAAA,CAAA,uBAAA,EAAA,yBAAA,CAAA;AAqBT,SAAS,eAAe,QAAA,EAAkB;AAChD,EAAA,OAAO,QAAA,GAAW,CAAA;AACnB;AAFgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA;AAIT,SAAS,gBAAgB,QAAA,EAAkB;AACjD,EAAA,OAAO,QAAA,KAAa,CAAA;AACrB;AAFgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA;AAIT,SAAS,kBAAkB,QAAA,EAAkB;AACnD,EAAA,OAAO,QAAA,GAAW,CAAA;AACnB;AAFgB,MAAA,CAAA,iBAAA,EAAA,mBAAA,CAAA","file":"_compare.mjs","sourcesContent":["/**\n * Represents the result of a lexicographic comparison.\n *\n * The operations are as follows:\n *\n * - Two iterators are compared element by element.\n * - The first pair of unequal elements determines the result.\n * - If one sequence is a prefix of the other, the shorter sequence is lexicographically less than the other.\n * - If two sequences have the same elements in the same order, they are lexicographically equal.\n * - An empty sequence is lexicographically less than any non-empty sequence.\n * - Two empty sequences are lexicographically equal.\n */\nexport type LexicographicComparison = -1 | 0 | 1;\n\nexport type CompareByComparator<ElementType> = (x: Exclude<ElementType, undefined>, y: Exclude<ElementType, undefined>) => number;\n\nexport function compareIteratorElements<const ElementType>(\n\tx: ElementType | undefined,\n\ty: ElementType | undefined,\n\tcomparator: CompareByComparator<ElementType>\n): number {\n\t// 23.1.3.30.2 CompareArrayElements (https://tc39.es/ecma262/#sec-comparearrayelements)\n\tif (typeof x === 'undefined') {\n\t\t// 1. If x and y are both `undefined`, return +0.\n\t\tif (typeof y === 'undefined') return 0;\n\t\t// 2. If x is `undefined`, return +1.\n\t\treturn 1;\n\t}\n\n\tif (typeof y === 'undefined') {\n\t\t// 3. If y is `undefined`, return -1.\n\t\treturn -1;\n\t}\n\n\treturn comparator(x as Exclude<ElementType, undefined>, y as Exclude<ElementType, undefined>);\n}\n\nexport function orderingIsLess(ordering: number) {\n\treturn ordering < 0;\n}\n\nexport function orderingIsEqual(ordering: number) {\n\treturn ordering === 0;\n}\n\nexport function orderingIsGreater(ordering: number) {\n\treturn ordering > 0;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_makeIterableIterator.ts"],"names":[],"mappings":";;;AAAO,SAAS,qBAAwC,IAAoE,EAAA;AAC3H,EAAO,OAAA;AAAA,IACN,IAAA;AAAA,IACA,CAAC,MAAO,CAAA,QAAQ,CAAI,GAAA;AACnB,MAAO,OAAA,IAAA;AAAA;AACR,GACD;AACD;AAPgB,MAAA,CAAA,oBAAA,EAAA,sBAAA,CAAA","file":"_makeIterableIterator.mjs","sourcesContent":["export function makeIterableIterator<const ElementType>(next: Iterator<ElementType>['next']): IterableIterator<ElementType> {\n\treturn {\n\t\tnext,\n\t\t[Symbol.iterator]() {\n\t\t\treturn this;\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_makeIterableIterator.ts"],"names":[],"mappings":";;;AAAO,SAAS,qBAAwC,IAAA,EAAoE;AAC3H,EAAA,OAAO;AAAA,IACN,IAAA;AAAA,IACA,CAAC,MAAA,CAAO,QAAQ,CAAA,GAAI;AACnB,MAAA,OAAO,IAAA;AAAA,IACR;AAAA,GACD;AACD;AAPgB,MAAA,CAAA,oBAAA,EAAA,sBAAA,CAAA","file":"_makeIterableIterator.mjs","sourcesContent":["export function makeIterableIterator<const ElementType>(next: Iterator<ElementType>['next']): IterableIterator<ElementType> {\n\treturn {\n\t\tnext,\n\t\t[Symbol.iterator]() {\n\t\t\treturn this;\n\t\t}\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_toIntegerOrInfinityOrThrow.ts"],"names":[],"mappings":";;;AAEO,SAAS,2BAA2B,KAAuB,EAAA;AACjE,EAAM,MAAA,MAAA,GAAS,gBAAgB,KAAK,CAAA;AACpC,EAAA,IAAI,OAAO,KAAM,CAAA,MAAM,CAAK,IAAA,MAAA,KAAW,GAAU,OAAA,CAAA;AACjD,EAAA,IAAI,MAAW,KAAA,MAAA,CAAO,iBAAmB,EAAA,OAAO,MAAO,CAAA,iBAAA;AACvD,EAAA,IAAI,MAAW,KAAA,MAAA,CAAO,iBAAmB,EAAA,OAAO,MAAO,CAAA,iBAAA;AAEvD,EAAO,OAAA,IAAA,CAAK,MAAM,MAAM,CAAA;AACzB;AAPgB,MAAA,CAAA,0BAAA,EAAA,4BAAA,CAAA","file":"_toIntegerOrInfinityOrThrow.mjs","sourcesContent":["import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrInfinityOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) return Number.POSITIVE_INFINITY;\n\tif (number === Number.NEGATIVE_INFINITY) return Number.NEGATIVE_INFINITY;\n\n\treturn Math.trunc(number);\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_toIntegerOrInfinityOrThrow.ts"],"names":[],"mappings":";;;AAEO,SAAS,2BAA2B,KAAA,EAAuB;AACjE,EAAA,MAAM,MAAA,GAAS,gBAAgB,KAAK,CAAA;AACpC,EAAA,IAAI,OAAO,KAAA,CAAM,MAAM,CAAA,IAAK,MAAA,KAAW,GAAG,OAAO,CAAA;AACjD,EAAA,IAAI,MAAA,KAAW,MAAA,CAAO,iBAAA,EAAmB,OAAO,MAAA,CAAO,iBAAA;AACvD,EAAA,IAAI,MAAA,KAAW,MAAA,CAAO,iBAAA,EAAmB,OAAO,MAAA,CAAO,iBAAA;AAEvD,EAAA,OAAO,IAAA,CAAK,MAAM,MAAM,CAAA;AACzB;AAPgB,MAAA,CAAA,0BAAA,EAAA,4BAAA,CAAA","file":"_toIntegerOrInfinityOrThrow.mjs","sourcesContent":["import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrInfinityOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) return Number.POSITIVE_INFINITY;\n\tif (number === Number.NEGATIVE_INFINITY) return Number.NEGATIVE_INFINITY;\n\n\treturn Math.trunc(number);\n}\n"]}