@sapphire/iterator-utilities 2.1.0-next.fb5ad246 → 3.0.0-pr-935.7da5c8bb

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 (172) 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.map +1 -1
  8. package/dist/cjs/lib/compare.cjs.map +1 -1
  9. package/dist/cjs/lib/compareBy.cjs.map +1 -1
  10. package/dist/cjs/lib/compress.cjs.map +1 -1
  11. package/dist/cjs/lib/contains.cjs.map +1 -1
  12. package/dist/cjs/lib/count.cjs.map +1 -1
  13. package/dist/cjs/lib/cycle.cjs.map +1 -1
  14. package/dist/cjs/lib/difference.cjs.map +1 -1
  15. package/dist/cjs/lib/drop.cjs.map +1 -1
  16. package/dist/cjs/lib/dropLast.cjs.map +1 -1
  17. package/dist/cjs/lib/dropWhile.cjs.map +1 -1
  18. package/dist/cjs/lib/empty.cjs.map +1 -1
  19. package/dist/cjs/lib/enumerate.cjs.map +1 -1
  20. package/dist/cjs/lib/equal.cjs.map +1 -1
  21. package/dist/cjs/lib/equalBy.cjs.map +1 -1
  22. package/dist/cjs/lib/every.cjs.map +1 -1
  23. package/dist/cjs/lib/filter.cjs.map +1 -1
  24. package/dist/cjs/lib/find.cjs.map +1 -1
  25. package/dist/cjs/lib/findIndex.cjs.map +1 -1
  26. package/dist/cjs/lib/first.cjs.map +1 -1
  27. package/dist/cjs/lib/flat.cjs.map +1 -1
  28. package/dist/cjs/lib/flatMap.cjs.map +1 -1
  29. package/dist/cjs/lib/forEach.cjs.map +1 -1
  30. package/dist/cjs/lib/from.cjs.map +1 -1
  31. package/dist/cjs/lib/fuse.cjs.map +1 -1
  32. package/dist/cjs/lib/greaterOrEqualThan.cjs.map +1 -1
  33. package/dist/cjs/lib/greaterThan.cjs.map +1 -1
  34. package/dist/cjs/lib/indexOf.cjs.map +1 -1
  35. package/dist/cjs/lib/inspect.cjs.map +1 -1
  36. package/dist/cjs/lib/intersect.cjs.map +1 -1
  37. package/dist/cjs/lib/intersperse.cjs.map +1 -1
  38. package/dist/cjs/lib/isEmpty.cjs.map +1 -1
  39. package/dist/cjs/lib/isSorted.cjs.map +1 -1
  40. package/dist/cjs/lib/isSortedBy.cjs.map +1 -1
  41. package/dist/cjs/lib/isSortedByKey.cjs.map +1 -1
  42. package/dist/cjs/lib/last.cjs.map +1 -1
  43. package/dist/cjs/lib/lessOrEqualThan.cjs.map +1 -1
  44. package/dist/cjs/lib/lessThan.cjs.map +1 -1
  45. package/dist/cjs/lib/map.cjs.map +1 -1
  46. package/dist/cjs/lib/max.cjs.map +1 -1
  47. package/dist/cjs/lib/maxBy.cjs.map +1 -1
  48. package/dist/cjs/lib/maxByKey.cjs.map +1 -1
  49. package/dist/cjs/lib/min.cjs.map +1 -1
  50. package/dist/cjs/lib/minBy.cjs.map +1 -1
  51. package/dist/cjs/lib/minByKey.cjs.map +1 -1
  52. package/dist/cjs/lib/notEqual.cjs.map +1 -1
  53. package/dist/cjs/lib/partition.cjs.map +1 -1
  54. package/dist/cjs/lib/peekable.cjs.map +1 -1
  55. package/dist/cjs/lib/prepend.cjs.map +1 -1
  56. package/dist/cjs/lib/product.cjs.map +1 -1
  57. package/dist/cjs/lib/range.cjs.map +1 -1
  58. package/dist/cjs/lib/reduce.cjs.map +1 -1
  59. package/dist/cjs/lib/repeat.cjs.map +1 -1
  60. package/dist/cjs/lib/reverse.cjs.map +1 -1
  61. package/dist/cjs/lib/shared/_assertFunction.cjs.map +1 -1
  62. package/dist/cjs/lib/shared/_assertNotNegative.cjs.map +1 -1
  63. package/dist/cjs/lib/shared/_assertPositive.cjs.map +1 -1
  64. package/dist/cjs/lib/shared/_compare.cjs.map +1 -1
  65. package/dist/cjs/lib/shared/_makeIterableIterator.cjs.map +1 -1
  66. package/dist/cjs/lib/shared/_toIntegerOrInfinityOrThrow.cjs.map +1 -1
  67. package/dist/cjs/lib/shared/_toIntegerOrThrow.cjs.map +1 -1
  68. package/dist/cjs/lib/shared/_toNumberOrThrow.cjs.map +1 -1
  69. package/dist/cjs/lib/shared/comparators.cjs.map +1 -1
  70. package/dist/cjs/lib/slice.cjs.map +1 -1
  71. package/dist/cjs/lib/some.cjs.map +1 -1
  72. package/dist/cjs/lib/sorted.cjs.map +1 -1
  73. package/dist/cjs/lib/starMap.cjs.map +1 -1
  74. package/dist/cjs/lib/stepBy.cjs.map +1 -1
  75. package/dist/cjs/lib/sum.cjs.map +1 -1
  76. package/dist/cjs/lib/take.cjs.map +1 -1
  77. package/dist/cjs/lib/takeLast.cjs.map +1 -1
  78. package/dist/cjs/lib/tee.cjs.map +1 -1
  79. package/dist/cjs/lib/toArray.cjs.map +1 -1
  80. package/dist/cjs/lib/toIterableIterator.cjs.map +1 -1
  81. package/dist/cjs/lib/union.cjs.map +1 -1
  82. package/dist/cjs/lib/unique.cjs.map +1 -1
  83. package/dist/cjs/lib/unzip.cjs.map +1 -1
  84. package/dist/cjs/lib/windows.cjs.map +1 -1
  85. package/dist/cjs/lib/zip.cjs.map +1 -1
  86. package/dist/esm/lib/append.mjs.map +1 -1
  87. package/dist/esm/lib/at.mjs.map +1 -1
  88. package/dist/esm/lib/average.mjs.map +1 -1
  89. package/dist/esm/lib/chain.mjs.map +1 -1
  90. package/dist/esm/lib/chunk.mjs.map +1 -1
  91. package/dist/esm/lib/collectInto.mjs.map +1 -1
  92. package/dist/esm/lib/compact.mjs.map +1 -1
  93. package/dist/esm/lib/compare.mjs.map +1 -1
  94. package/dist/esm/lib/compareBy.mjs.map +1 -1
  95. package/dist/esm/lib/compress.mjs.map +1 -1
  96. package/dist/esm/lib/contains.mjs.map +1 -1
  97. package/dist/esm/lib/count.mjs.map +1 -1
  98. package/dist/esm/lib/cycle.mjs.map +1 -1
  99. package/dist/esm/lib/difference.mjs.map +1 -1
  100. package/dist/esm/lib/drop.mjs.map +1 -1
  101. package/dist/esm/lib/dropLast.mjs.map +1 -1
  102. package/dist/esm/lib/dropWhile.mjs.map +1 -1
  103. package/dist/esm/lib/empty.mjs.map +1 -1
  104. package/dist/esm/lib/enumerate.mjs.map +1 -1
  105. package/dist/esm/lib/equal.mjs.map +1 -1
  106. package/dist/esm/lib/equalBy.mjs.map +1 -1
  107. package/dist/esm/lib/every.mjs.map +1 -1
  108. package/dist/esm/lib/filter.mjs.map +1 -1
  109. package/dist/esm/lib/find.mjs.map +1 -1
  110. package/dist/esm/lib/findIndex.mjs.map +1 -1
  111. package/dist/esm/lib/first.mjs.map +1 -1
  112. package/dist/esm/lib/flat.mjs.map +1 -1
  113. package/dist/esm/lib/flatMap.mjs.map +1 -1
  114. package/dist/esm/lib/forEach.mjs.map +1 -1
  115. package/dist/esm/lib/from.mjs.map +1 -1
  116. package/dist/esm/lib/fuse.mjs.map +1 -1
  117. package/dist/esm/lib/greaterOrEqualThan.mjs.map +1 -1
  118. package/dist/esm/lib/greaterThan.mjs.map +1 -1
  119. package/dist/esm/lib/indexOf.mjs.map +1 -1
  120. package/dist/esm/lib/inspect.mjs.map +1 -1
  121. package/dist/esm/lib/intersect.mjs.map +1 -1
  122. package/dist/esm/lib/intersperse.mjs.map +1 -1
  123. package/dist/esm/lib/isEmpty.mjs.map +1 -1
  124. package/dist/esm/lib/isSorted.mjs.map +1 -1
  125. package/dist/esm/lib/isSortedBy.mjs.map +1 -1
  126. package/dist/esm/lib/isSortedByKey.mjs.map +1 -1
  127. package/dist/esm/lib/last.mjs.map +1 -1
  128. package/dist/esm/lib/lessOrEqualThan.mjs.map +1 -1
  129. package/dist/esm/lib/lessThan.mjs.map +1 -1
  130. package/dist/esm/lib/map.mjs.map +1 -1
  131. package/dist/esm/lib/max.mjs.map +1 -1
  132. package/dist/esm/lib/maxBy.mjs.map +1 -1
  133. package/dist/esm/lib/maxByKey.mjs.map +1 -1
  134. package/dist/esm/lib/min.mjs.map +1 -1
  135. package/dist/esm/lib/minBy.mjs.map +1 -1
  136. package/dist/esm/lib/minByKey.mjs.map +1 -1
  137. package/dist/esm/lib/notEqual.mjs.map +1 -1
  138. package/dist/esm/lib/partition.mjs.map +1 -1
  139. package/dist/esm/lib/peekable.mjs.map +1 -1
  140. package/dist/esm/lib/prepend.mjs.map +1 -1
  141. package/dist/esm/lib/product.mjs.map +1 -1
  142. package/dist/esm/lib/range.mjs.map +1 -1
  143. package/dist/esm/lib/reduce.mjs.map +1 -1
  144. package/dist/esm/lib/repeat.mjs.map +1 -1
  145. package/dist/esm/lib/reverse.mjs.map +1 -1
  146. package/dist/esm/lib/shared/_assertFunction.mjs.map +1 -1
  147. package/dist/esm/lib/shared/_assertNotNegative.mjs.map +1 -1
  148. package/dist/esm/lib/shared/_assertPositive.mjs.map +1 -1
  149. package/dist/esm/lib/shared/_compare.mjs.map +1 -1
  150. package/dist/esm/lib/shared/_makeIterableIterator.mjs.map +1 -1
  151. package/dist/esm/lib/shared/_toIntegerOrInfinityOrThrow.mjs.map +1 -1
  152. package/dist/esm/lib/shared/_toIntegerOrThrow.mjs.map +1 -1
  153. package/dist/esm/lib/shared/_toNumberOrThrow.mjs.map +1 -1
  154. package/dist/esm/lib/shared/comparators.mjs.map +1 -1
  155. package/dist/esm/lib/slice.mjs.map +1 -1
  156. package/dist/esm/lib/some.mjs.map +1 -1
  157. package/dist/esm/lib/sorted.mjs.map +1 -1
  158. package/dist/esm/lib/starMap.mjs.map +1 -1
  159. package/dist/esm/lib/stepBy.mjs.map +1 -1
  160. package/dist/esm/lib/sum.mjs.map +1 -1
  161. package/dist/esm/lib/take.mjs.map +1 -1
  162. package/dist/esm/lib/takeLast.mjs.map +1 -1
  163. package/dist/esm/lib/tee.mjs.map +1 -1
  164. package/dist/esm/lib/toArray.mjs.map +1 -1
  165. package/dist/esm/lib/toIterableIterator.mjs.map +1 -1
  166. package/dist/esm/lib/union.mjs.map +1 -1
  167. package/dist/esm/lib/unique.mjs.map +1 -1
  168. package/dist/esm/lib/unzip.mjs.map +1 -1
  169. package/dist/esm/lib/windows.mjs.map +1 -1
  170. package/dist/esm/lib/zip.mjs.map +1 -1
  171. package/dist/iife/index.global.js.map +1 -1
  172. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/lessOrEqualThan.ts"],"names":["compare","orderingIsGreater"],"mappings":";;;;;;;AA+BO,SAAS,eAAA,CAAmC,UAA2C,KAAiD,EAAA;AAC9I,EAAM,MAAA,MAAA,GAASA,mBAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAO,OAAA,CAACC,+BAAkB,MAAM,CAAA;AACjC;AAHgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA","file":"lessOrEqualThan.cjs","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":["compare","orderingIsGreater"],"mappings":";;;;;;;AA+BO,SAAS,eAAA,CAAmC,UAA2C,KAAA,EAAiD;AAC9I,EAAA,MAAM,MAAA,GAASA,mBAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,CAACC,+BAAkB,MAAM,CAAA;AACjC;AAHgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA","file":"lessOrEqualThan.cjs","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":["compare","orderingIsLess"],"mappings":";;;;;;;AA+BO,SAAS,QAAA,CAA4B,UAA2C,KAAiD,EAAA;AACvI,EAAM,MAAA,MAAA,GAASA,mBAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAOC,4BAAe,MAAM,CAAA;AAC7B;AAHgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"lessThan.cjs","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":["compare","orderingIsLess"],"mappings":";;;;;;;AA+BO,SAAS,QAAA,CAA4B,UAA2C,KAAA,EAAiD;AACvI,EAAA,MAAM,MAAA,GAASA,mBAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAOC,4BAAe,MAAM,CAAA;AAC7B;AAHgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"lessThan.cjs","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":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAmBO,UAAU,GAAA,CAChB,UACA,UAC+B,EAAA;AAC/B,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAM,MAAA,UAAA,CAAW,SAAS,KAAO,EAAA,CAAA;AAAA;AAEnC;AAViB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"map.cjs","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":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAmBO,UAAU,GAAA,CAChB,UACA,UAAA,EAC+B;AAC/B,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,OAAA,IAAWC,yCAAA,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.cjs","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":["maxBy","defaultCompare"],"mappings":";;;;;;;AA8BO,SAAS,IAAuB,QAA+D,EAAA;AACrG,EAAO,OAAAA,eAAA,CAAM,UAAUC,8BAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"max.cjs","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":["maxBy","defaultCompare"],"mappings":";;;;;;;AA8BO,SAAS,IAAuB,QAAA,EAA+D;AACrG,EAAA,OAAOA,eAAA,CAAM,UAAUC,8BAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"max.cjs","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":["assertFunction","toIterableIterator","compareIteratorElements","orderingIsLess"],"mappings":";;;;;;;;AAgCO,SAAS,KAAA,CACf,UACA,UACqB,EAAA;AACrB,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAWC,0CAAmB,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,GAAAC,oCAAA,CAAqC,KAAO,EAAA,OAAA,EAAS,UAAU,CAAA;AAClF,IAAI,IAAA,CAACC,2BAAe,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.cjs","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":["assertFunction","toIterableIterator","compareIteratorElements","orderingIsLess"],"mappings":";;;;;;;;AAgCO,SAAS,KAAA,CACf,UACA,UAAA,EACqB;AACrB,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAWC,0CAAmB,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,GAAaC,oCAAA,CAAqC,KAAA,EAAO,OAAA,EAAS,UAAU,CAAA;AAClF,IAAA,IAAI,CAACC,2BAAA,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.cjs","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":["defaultCompare","assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;;AAkCO,SAAS,QACf,CAAA,QAAA,EACA,UACA,EAAA,UAAA,GAA8CA,8BACzB,EAAA;AACrB,EAAA,UAAA,GAAaC,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAWC,0CAAmB,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,GAAAC,oCAAA,CAAoC,UAAY,EAAA,GAAA,EAAK,UAAU,CAAA;AAElF,IAAI,IAAA,CAACC,8BAAkB,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.cjs","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":["defaultCompare","assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;;AAkCO,SAAS,QAAA,CACf,QAAA,EACA,UAAA,EACA,UAAA,GAA8CA,8BAAA,EACzB;AACrB,EAAA,UAAA,GAAaC,mCAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAWC,0CAAmB,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,GAAaC,oCAAA,CAAoC,UAAA,EAAY,GAAA,EAAK,UAAU,CAAA;AAElF,IAAA,IAAI,CAACC,8BAAA,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.cjs","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":["minBy","defaultCompare"],"mappings":";;;;;;;AA8BO,SAAS,IAAuB,QAA+D,EAAA;AACrG,EAAO,OAAAA,eAAA,CAAM,UAAUC,8BAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"min.cjs","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":["minBy","defaultCompare"],"mappings":";;;;;;;AA8BO,SAAS,IAAuB,QAAA,EAA+D;AACrG,EAAA,OAAOA,eAAA,CAAM,UAAUC,8BAAc,CAAA;AACtC;AAFgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"min.cjs","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":["assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;AAgCO,SAAS,KAAA,CACf,UACA,UACqB,EAAA;AACrB,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAWC,0CAAmB,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,GAAAC,oCAAA,CAAqC,KAAO,EAAA,OAAA,EAAS,UAAU,CAAA;AAElF,IAAI,IAAA,CAACC,8BAAkB,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.cjs","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":["assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;AAgCO,SAAS,KAAA,CACf,UACA,UAAA,EACqB;AACrB,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAWC,0CAAmB,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,GAAaC,oCAAA,CAAqC,KAAA,EAAO,OAAA,EAAS,UAAU,CAAA;AAElF,IAAA,IAAI,CAACC,8BAAA,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.cjs","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":["defaultCompare","assertFunction","toIterableIterator","compareIteratorElements","orderingIsLess"],"mappings":";;;;;;;;;AAiCO,SAAS,QACf,CAAA,QAAA,EACA,UACA,EAAA,UAAA,GAA8CA,8BACzB,EAAA;AACrB,EAAA,UAAA,GAAaC,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAWC,0CAAmB,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,GAAAC,oCAAA,CAAoC,UAAY,EAAA,GAAA,EAAK,UAAU,CAAA;AAElF,IAAI,IAAA,CAACC,2BAAe,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.cjs","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":["defaultCompare","assertFunction","toIterableIterator","compareIteratorElements","orderingIsLess"],"mappings":";;;;;;;;;AAiCO,SAAS,QAAA,CACf,QAAA,EACA,UAAA,EACA,UAAA,GAA8CA,8BAAA,EACzB;AACrB,EAAA,UAAA,GAAaC,mCAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAWC,0CAAmB,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,GAAaC,oCAAA,CAAoC,UAAA,EAAY,GAAA,EAAK,UAAU,CAAA;AAElF,IAAA,IAAI,CAACC,2BAAA,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.cjs","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":["equal"],"mappings":";;;;;;AAwBO,SAAS,QAAA,CAA4B,UAA2C,KAAiD,EAAA;AACvI,EAAO,OAAA,CAACA,eAAM,CAAA,QAAA,EAAU,KAAK,CAAA;AAC9B;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"notEqual.cjs","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":["equal"],"mappings":";;;;;;AAwBO,SAAS,QAAA,CAA4B,UAA2C,KAAA,EAAiD;AACvI,EAAA,OAAO,CAACA,eAAA,CAAM,QAAA,EAAU,KAAK,CAAA;AAC9B;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"notEqual.cjs","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":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAwCO,SAAS,SAAA,CACf,UACA,SACiC,EAAA;AACjC,EAAA,SAAA,GAAYA,mCAAe,SAAS,CAAA;AAEpC,EAAA,MAAM,aAA4B,EAAC;AACnC,EAAA,MAAM,cAA6B,EAAC;AAEpC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,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.cjs","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":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAwCO,SAAS,SAAA,CACf,UACA,SAAA,EACiC;AACjC,EAAA,SAAA,GAAYA,mCAAe,SAAS,CAAA;AAEpC,EAAA,MAAM,aAA4B,EAAC;AACnC,EAAA,MAAM,cAA6B,EAAC;AAEpC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,KAAA,IAASC,yCAAA,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.cjs","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 +1 @@
1
- {"version":3,"sources":["../../../src/lib/peekable.ts"],"names":["from"],"mappings":";;;;;;AA6BO,SAAS,SAA4B,QAAkE,EAAA;AAC7G,EAAM,MAAA,gBAAA,GAAmBA,cAAK,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,MAAA;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.cjs","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":["from"],"mappings":";;;;;;AA6BO,SAAS,SAA4B,QAAA,EAAkE;AAC7G,EAAA,MAAM,gBAAA,GAAmBA,cAAK,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.cjs","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","toIterableIterator"],"mappings":";;;;;;AAoBO,UAAU,OAAA,CAChB,aACG,SAC6B,EAAA;AAChC,EAAA,KAAA,MAAWA,aAAY,SAAW,EAAA;AACjC,IAAA,OAAOC,0CAAmBD,SAAQ,CAAA;AAAA;AAGnC,EAAA,OAAOC,0CAAmB,QAAQ,CAAA;AACnC;AATiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"prepend.cjs","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","toIterableIterator"],"mappings":";;;;;;AAoBO,UAAU,OAAA,CAChB,aACG,SAAA,EAC6B;AAChC,EAAA,KAAA,MAAWA,aAAY,SAAA,EAAW;AACjC,IAAA,OAAOC,0CAAmBD,SAAQ,CAAA;AAAA,EACnC;AAEA,EAAA,OAAOC,0CAAmB,QAAQ,CAAA;AACnC;AATiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"prepend.cjs","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":["map","toNumberOrThrow"],"mappings":";;;;;;;AAuBO,SAAS,QAAQ,QAA8C,EAAA;AACrE,EAAA,IAAI,MAAS,GAAA,CAAA;AACb,EAAA,KAAA,MAAW,KAAS,IAAAA,WAAA,CAAI,QAAU,EAAAC,oCAAe,CAAG,EAAA;AACnD,IAAU,MAAA,IAAA,KAAA;AAAA;AAGX,EAAO,OAAA,MAAA;AACR;AAPgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"product.cjs","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":["map","toNumberOrThrow"],"mappings":";;;;;;;AAuBO,SAAS,QAAQ,QAAA,EAA8C;AACrE,EAAA,IAAI,MAAA,GAAS,CAAA;AACb,EAAA,KAAA,MAAW,KAAA,IAASA,WAAA,CAAI,QAAA,EAAUC,oCAAe,CAAA,EAAG;AACnD,IAAA,MAAA,IAAU,KAAA;AAAA,EACX;AAEA,EAAA,OAAO,MAAA;AACR;AAPgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"product.cjs","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 +1 @@
1
- {"version":3,"sources":["../../../src/lib/range.ts"],"names":["toNumberOrThrow"],"mappings":";;;;;;AAgCO,UAAU,KAAA,CAAM,KAAe,EAAA,GAAA,EAAa,IAAqD,EAAA;AACvG,EAAA,KAAA,GAAQA,qCAAgB,KAAK,CAAA;AAC7B,EAAA,GAAA,GAAMA,qCAAgB,GAAG,CAAA;AAEzB,EAAA,IAAI,SAAS,MAAW,EAAA;AACvB,IAAO,IAAA,GAAA,KAAA,GAAQ,MAAM,CAAI,GAAA,EAAA;AAAA,GACnB,MAAA;AACN,IAAA,IAAA,GAAOA,qCAAgB,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.cjs","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":["toNumberOrThrow"],"mappings":";;;;;;AAgCO,UAAU,KAAA,CAAM,KAAA,EAAe,GAAA,EAAa,IAAA,EAAqD;AACvG,EAAA,KAAA,GAAQA,qCAAgB,KAAK,CAAA;AAC7B,EAAA,GAAA,GAAMA,qCAAgB,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,GAAOA,qCAAgB,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.cjs","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":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAgCO,SAAS,MAAA,CACf,QACA,EAAA,UAAA,EACA,YACa,EAAA;AACb,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAI,IAAA,KAAA;AACJ,EAAI,IAAA,WAAA;AACJ,EAAM,MAAA,gBAAA,GAAmBC,0CAAmB,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.cjs","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":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAgCO,SAAS,MAAA,CACf,QAAA,EACA,UAAA,EACA,YAAA,EACa;AACb,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAA;AACJ,EAAA,IAAI,WAAA;AACJ,EAAA,MAAM,gBAAA,GAAmBC,0CAAmB,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.cjs","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 +1 @@
1
- {"version":3,"sources":["../../../src/lib/repeat.ts"],"names":["assertNotNegative","toNumberOrThrow","makeIterableIterator"],"mappings":";;;;;;;;AAqBO,SAAS,MAAA,CAA0B,OAAoB,KAA8C,EAAA;AAC3G,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,oCAAA,CAAgB,KAAK,CAAA,EAAG,KAAK,CAAA;AAEvD,EAAA,IAAI,CAAI,GAAA,CAAA;AACR,EAAO,OAAAC,8CAAA;AAAA,IAAkC,MACxC,CAAA,IAAK,KACF,GAAA,EAAE,IAAM,EAAA,IAAA,EAAM,KAAO,EAAA,MAAA,EACpB,IAAA,CAAA,EAAA,EAAK,EAAE,IAAA,EAAM,OAAO,KAAM,EAAA;AAAA,GAC/B;AACD;AATgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"repeat.cjs","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":["assertNotNegative","toNumberOrThrow","makeIterableIterator"],"mappings":";;;;;;;;AAqBO,SAAS,MAAA,CAA0B,OAAoB,KAAA,EAA8C;AAC3G,EAAA,KAAA,GAAQA,wCAAA,CAAkBC,oCAAA,CAAgB,KAAK,CAAA,EAAG,KAAK,CAAA;AAEvD,EAAA,IAAI,CAAA,GAAI,CAAA;AACR,EAAA,OAAOC,8CAAA;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.cjs","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":["collect"],"mappings":";;;;;;AAwBO,UAAU,QAA2B,QAA0E,EAAA;AACrH,EAAM,MAAA,KAAA,GAAQA,oBAAQ,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.cjs","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":["collect"],"mappings":";;;;;;AAwBO,UAAU,QAA2B,QAAA,EAA0E;AACrH,EAAA,MAAM,KAAA,GAAQA,oBAAQ,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.cjs","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.cjs","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.cjs","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.cjs","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.cjs","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.cjs","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.cjs","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.cjs","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.cjs","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.cjs","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.cjs","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":["toNumberOrThrow"],"mappings":";;;;;;AAEO,SAAS,2BAA2B,KAAuB,EAAA;AACjE,EAAM,MAAA,MAAA,GAASA,qCAAgB,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.cjs","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":["toNumberOrThrow"],"mappings":";;;;;;AAEO,SAAS,2BAA2B,KAAA,EAAuB;AACjE,EAAA,MAAM,MAAA,GAASA,qCAAgB,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.cjs","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 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_toIntegerOrThrow.ts"],"names":["toNumberOrThrow"],"mappings":";;;;;;AAEO,SAAS,iBAAiB,KAAuB,EAAA;AACvD,EAAM,MAAA,MAAA,GAASA,qCAAgB,KAAK,CAAA;AACpC,EAAA,IAAI,OAAO,KAAM,CAAA,MAAM,CAAK,IAAA,MAAA,KAAW,GAAU,OAAA,CAAA;AACjD,EAAA,IAAI,WAAW,MAAO,CAAA,iBAAA,EAAyB,MAAA,IAAI,WAAW,+CAA+C,CAAA;AAC7G,EAAA,IAAI,WAAW,MAAO,CAAA,iBAAA,EAAyB,MAAA,IAAI,WAAW,+CAA+C,CAAA;AAE7G,EAAO,OAAA,IAAA,CAAK,MAAM,MAAM,CAAA;AACzB;AAPgB,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA","file":"_toIntegerOrThrow.cjs","sourcesContent":["import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) throw new RangeError('+Infinity cannot be represented as an integer');\n\tif (number === Number.NEGATIVE_INFINITY) throw new RangeError('-Infinity cannot be represented as an integer');\n\n\treturn Math.trunc(number);\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_toIntegerOrThrow.ts"],"names":["toNumberOrThrow"],"mappings":";;;;;;AAEO,SAAS,iBAAiB,KAAA,EAAuB;AACvD,EAAA,MAAM,MAAA,GAASA,qCAAgB,KAAK,CAAA;AACpC,EAAA,IAAI,OAAO,KAAA,CAAM,MAAM,CAAA,IAAK,MAAA,KAAW,GAAG,OAAO,CAAA;AACjD,EAAA,IAAI,WAAW,MAAA,CAAO,iBAAA,EAAmB,MAAM,IAAI,WAAW,+CAA+C,CAAA;AAC7G,EAAA,IAAI,WAAW,MAAA,CAAO,iBAAA,EAAmB,MAAM,IAAI,WAAW,+CAA+C,CAAA;AAE7G,EAAA,OAAO,IAAA,CAAK,MAAM,MAAM,CAAA;AACzB;AAPgB,MAAA,CAAA,gBAAA,EAAA,kBAAA,CAAA","file":"_toIntegerOrThrow.cjs","sourcesContent":["import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) throw new RangeError('+Infinity cannot be represented as an integer');\n\tif (number === Number.NEGATIVE_INFINITY) throw new RangeError('-Infinity cannot be represented as an integer');\n\n\treturn Math.trunc(number);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/_toNumberOrThrow.ts"],"names":[],"mappings":";;;;;;AAAO,SAAS,gBAAgB,KAAiC,EAAA;AAChE,EAAA,QAAQ,OAAO,KAAO;AAAA,IACrB,KAAK,QAAA;AACJ,MAAM,MAAA,IAAI,UAAU,2CAA2C,CAAA;AAAA,IAChE,KAAK,QAAA;AACJ,MAAM,MAAA,IAAI,UAAU,2CAA2C,CAAA;AAAA,IAChE,KAAK,SAAA;AACJ,MAAA,OAAO,QAAQ,CAAI,GAAA,CAAA;AAAA,IACpB,KAAK,QAAA;AACJ,MAAO,OAAA,YAAA,CAAa,OAAO,KAAK,CAAA;AAAA,IACjC,KAAK,WAAA;AACJ,MAAM,MAAA,IAAI,UAAU,+CAA+C,CAAA;AAAA,IACpE;AACC,MAAA,OAAO,YAAa,CAAA,MAAA,CAAO,KAAK,CAAA,EAAG,KAAK,CAAA;AAAA;AAE3C;AAfgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA;AAmBhB,SAAS,YAAA,CAAa,OAAe,QAA2B,EAAA;AAC/D,EAAI,IAAA,MAAA,CAAO,KAAM,CAAA,KAAK,CAAG,EAAA;AACxB,IAAA,MAAM,IAAI,UAAA,CAAW,CAAG,EAAA,QAAQ,CAA2B,yBAAA,CAAA,CAAA;AAAA;AAG5D,EAAO,OAAA,KAAA;AACR;AANS,MAAA,CAAA,YAAA,EAAA,cAAA,CAAA","file":"_toNumberOrThrow.cjs","sourcesContent":["export function toNumberOrThrow(value: NumberResolvable): number {\n\tswitch (typeof value) {\n\t\tcase 'bigint':\n\t\t\tthrow new TypeError('Cannot convert a BigInt value to a number');\n\t\tcase 'symbol':\n\t\t\tthrow new TypeError('Cannot convert a Symbol value to a number');\n\t\tcase 'boolean':\n\t\t\treturn value ? 1 : 0;\n\t\tcase 'number':\n\t\t\treturn assertNumber(value, value);\n\t\tcase 'undefined':\n\t\t\tthrow new TypeError('Cannot convert an undefined value to a number');\n\t\tdefault:\n\t\t\treturn assertNumber(Number(value), value);\n\t}\n}\n\nexport type NumberResolvable = number | boolean | null | { valueOf(): number | boolean | null } | { [Symbol.toPrimitive](): number | boolean | null };\n\nfunction assertNumber(value: number, original: unknown): number {\n\tif (Number.isNaN(value)) {\n\t\tthrow new RangeError(`${original} must be a non-NaN number`);\n\t}\n\n\treturn value;\n}\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/_toNumberOrThrow.ts"],"names":[],"mappings":";;;;;;AAAO,SAAS,gBAAgB,KAAA,EAAiC;AAChE,EAAA,QAAQ,OAAO,KAAA;AAAO,IACrB,KAAK,QAAA;AACJ,MAAA,MAAM,IAAI,UAAU,2CAA2C,CAAA;AAAA,IAChE,KAAK,QAAA;AACJ,MAAA,MAAM,IAAI,UAAU,2CAA2C,CAAA;AAAA,IAChE,KAAK,SAAA;AACJ,MAAA,OAAO,QAAQ,CAAA,GAAI,CAAA;AAAA,IACpB,KAAK,QAAA;AACJ,MAAA,OAAO,YAAA,CAAa,OAAO,KAAK,CAAA;AAAA,IACjC,KAAK,WAAA;AACJ,MAAA,MAAM,IAAI,UAAU,+CAA+C,CAAA;AAAA,IACpE;AACC,MAAA,OAAO,YAAA,CAAa,MAAA,CAAO,KAAK,CAAA,EAAG,KAAK,CAAA;AAAA;AAE3C;AAfgB,MAAA,CAAA,eAAA,EAAA,iBAAA,CAAA;AAmBhB,SAAS,YAAA,CAAa,OAAe,QAAA,EAA2B;AAC/D,EAAA,IAAI,MAAA,CAAO,KAAA,CAAM,KAAK,CAAA,EAAG;AACxB,IAAA,MAAM,IAAI,UAAA,CAAW,CAAA,EAAG,QAAQ,CAAA,yBAAA,CAA2B,CAAA;AAAA,EAC5D;AAEA,EAAA,OAAO,KAAA;AACR;AANS,MAAA,CAAA,YAAA,EAAA,cAAA,CAAA","file":"_toNumberOrThrow.cjs","sourcesContent":["export function toNumberOrThrow(value: NumberResolvable): number {\n\tswitch (typeof value) {\n\t\tcase 'bigint':\n\t\t\tthrow new TypeError('Cannot convert a BigInt value to a number');\n\t\tcase 'symbol':\n\t\t\tthrow new TypeError('Cannot convert a Symbol value to a number');\n\t\tcase 'boolean':\n\t\t\treturn value ? 1 : 0;\n\t\tcase 'number':\n\t\t\treturn assertNumber(value, value);\n\t\tcase 'undefined':\n\t\t\tthrow new TypeError('Cannot convert an undefined value to a number');\n\t\tdefault:\n\t\t\treturn assertNumber(Number(value), value);\n\t}\n}\n\nexport type NumberResolvable = number | boolean | null | { valueOf(): number | boolean | null } | { [Symbol.toPrimitive](): number | boolean | null };\n\nfunction assertNumber(value: number, original: unknown): number {\n\tif (Number.isNaN(value)) {\n\t\tthrow new RangeError(`${original} must be a non-NaN number`);\n\t}\n\n\treturn value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/shared/comparators.ts"],"names":[],"mappings":";;;;;;AAEA,SAAS,KAAwB,EAAwE,EAAA;AACxG,EAAA,OAAO,CAAC,CAAG,EAAA,CAAA,KAAO,CAAI,GAAA,EAAA,CAAG,GAAG,CAAC,CAAA;AAC9B;AAFS,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAgBF,SAAS,cAAA,CAAkC,GAAgB,CAAyC,EAAA;AAI1G,EAAA,OAAO,UAAU,MAAO,CAAA,CAAC,CAAG,EAAA,MAAA,CAAO,CAAC,CAAC,CAAA;AACtC;AALgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA;AAQH,IAAA,UAAA,GAAa,KAAK,cAAc;AAetC,SAAS,SAAA,CAAU,GAA6B,CAAsD,EAAA;AAE5G,EAAS,OAAA,CAAA,CAAA,GAAI,MAAM,CAAI,GAAA,CAAA,CAAA;AACxB;AAHgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA;AAIH,IAAA,UAAA,GAAa,KAAK,SAAS","file":"comparators.cjs","sourcesContent":["import type { CompareByComparator, LexicographicComparison } from './_compare';\n\nfunction swap<const ElementType>(cb: CompareByComparator<ElementType>): CompareByComparator<ElementType> {\n\treturn (x, y) => (0 - cb(x, y)) as LexicographicComparison;\n}\n\n/**\n * Compares two elements lexicographically using the default comparison algorithm.\n * @seealso 23.1.3.30.2 CompareArrayElements ({@link https://tc39.es/ecma262/#sec-comparearrayelements})\n *\n * @param x The first element to compare.\n * @param y The second element to compare.\n * @returns The lexicographic comparison of the two elements.\n *\n * @remarks\n *\n * This function is used as the comparison algorithm for {@link compareBy}.\n */\nexport function defaultCompare<const ElementType>(x: ElementType, y: ElementType): LexicographicComparison {\n\t// 5. Let xString be ? ToString(x).\n\t// 6. Let yString be ? ToString(y).\n\t// Steps 7-11 are optimized away by the usage of `ascNumber`.\n\treturn ascNumber(String(x), String(y));\n}\n\nexport { defaultCompare as ascString };\nexport const descString = swap(defaultCompare);\n\n/**\n * Compares two elements using the default comparison algorithm.\n *\n * @param x The first element to compare.\n * @param y The second element to compare.\n * @returns The numeric comparison of the two elements.\n *\n * @privateRemarks\n *\n * The implementation of this function is based on the optimized version of the\n * starship operator in Rust. The subtraction is intentional and is used to\n * determine the ordering of the two elements.\n */\nexport function ascNumber(x: number | bigint | string, y: number | bigint | string): LexicographicComparison {\n\t// @ts-expect-error: The subtraction is intentional\n\treturn ((x > y) - (x < y)) as LexicographicComparison;\n}\nexport const descNumber = swap(ascNumber);\n"]}
1
+ {"version":3,"sources":["../../../../src/lib/shared/comparators.ts"],"names":[],"mappings":";;;;;;AAEA,SAAS,KAAwB,EAAA,EAAwE;AACxG,EAAA,OAAO,CAAC,CAAA,EAAG,CAAA,KAAO,CAAA,GAAI,EAAA,CAAG,GAAG,CAAC,CAAA;AAC9B;AAFS,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAgBF,SAAS,cAAA,CAAkC,GAAgB,CAAA,EAAyC;AAI1G,EAAA,OAAO,UAAU,MAAA,CAAO,CAAC,CAAA,EAAG,MAAA,CAAO,CAAC,CAAC,CAAA;AACtC;AALgB,MAAA,CAAA,cAAA,EAAA,gBAAA,CAAA;AAQT,IAAM,UAAA,GAAa,KAAK,cAAc;AAetC,SAAS,SAAA,CAAU,GAA6B,CAAA,EAAsD;AAE5G,EAAA,OAAA,CAAS,CAAA,GAAI,MAAM,CAAA,GAAI,CAAA,CAAA;AACxB;AAHgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA;AAIT,IAAM,UAAA,GAAa,KAAK,SAAS","file":"comparators.cjs","sourcesContent":["import type { CompareByComparator, LexicographicComparison } from './_compare';\n\nfunction swap<const ElementType>(cb: CompareByComparator<ElementType>): CompareByComparator<ElementType> {\n\treturn (x, y) => (0 - cb(x, y)) as LexicographicComparison;\n}\n\n/**\n * Compares two elements lexicographically using the default comparison algorithm.\n * @seealso 23.1.3.30.2 CompareArrayElements ({@link https://tc39.es/ecma262/#sec-comparearrayelements})\n *\n * @param x The first element to compare.\n * @param y The second element to compare.\n * @returns The lexicographic comparison of the two elements.\n *\n * @remarks\n *\n * This function is used as the comparison algorithm for {@link compareBy}.\n */\nexport function defaultCompare<const ElementType>(x: ElementType, y: ElementType): LexicographicComparison {\n\t// 5. Let xString be ? ToString(x).\n\t// 6. Let yString be ? ToString(y).\n\t// Steps 7-11 are optimized away by the usage of `ascNumber`.\n\treturn ascNumber(String(x), String(y));\n}\n\nexport { defaultCompare as ascString };\nexport const descString = swap(defaultCompare);\n\n/**\n * Compares two elements using the default comparison algorithm.\n *\n * @param x The first element to compare.\n * @param y The second element to compare.\n * @returns The numeric comparison of the two elements.\n *\n * @privateRemarks\n *\n * The implementation of this function is based on the optimized version of the\n * starship operator in Rust. The subtraction is intentional and is used to\n * determine the ordering of the two elements.\n */\nexport function ascNumber(x: number | bigint | string, y: number | bigint | string): LexicographicComparison {\n\t// @ts-expect-error: The subtraction is intentional\n\treturn ((x > y) - (x < y)) as LexicographicComparison;\n}\nexport const descNumber = swap(ascNumber);\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/slice.ts"],"names":["toIntegerOrInfinityOrThrow","drop","takeLast","empty","dropLast","take"],"mappings":";;;;;;;;;;;AAiEO,SAAS,KAAA,CAAyB,QAA2C,EAAA,KAAA,EAAgB,GAA6C,EAAA;AAEhJ,EAAQ,KAAA,GAAAA,0DAAA,CAA2B,SAAS,CAAC,CAAA;AAC7C,EAAI,IAAA,KAAA,KAAU,OAAO,iBAAmB,EAAA;AACvC,IAAQ,KAAA,GAAA,CAAA;AAAA;AAKT,EAAA,IAAI,QAAQ,MAAW,EAAA;AACtB,IAAO,OAAA,KAAA,IAAS,IACbC,aAAK,CAAA,QAAA,EAAU,KAAK,CACpB,GAAAC,qBAAA,CAAS,QAAU,EAAA,CAAC,KAAK,CAAA;AAAA;AAG7B,EAAA,GAAA,GAAMF,2DAA2B,GAAG,CAAA;AAEpC,EAAA,IAAI,MAAM,CAAG,EAAA;AAGZ,IAAI,IAAA,GAAA,KAAQ,OAAO,iBAAmB,EAAA;AACrC,MAAA,OAAOG,eAAM,EAAA;AAAA;AAId,IAAA,IAAI,UAAU,CAAG,EAAA;AAChB,MAAO,OAAAC,qBAAA,CAAS,QAAU,EAAA,CAAC,GAAG,CAAA;AAAA;AAK/B,IAAA,IAAI,SAAS,CAAG,EAAA;AACf,MAAA,OAAOA,sBAASH,aAAK,CAAA,QAAA,EAAU,KAAK,CAAA,EAAG,CAAC,GAAG,CAAA;AAAA;AAK5C,IAAA,IAAI,SAAS,GAAK,EAAA;AACjB,MAAA,OAAOE,eAAM,EAAA;AAAA;AAKd,IAAA,OAAOE,cAAKH,qBAAS,CAAA,QAAA,EAAU,CAAC,KAAK,CAAA,EAAG,MAAM,KAAK,CAAA;AAAA;AAIpD,EAAI,IAAA,KAAA,IAAS,GAAK,EAAA,OAAOC,eAAM,EAAA;AAG/B,EAAA,OAAO,GAAQ,KAAA,MAAA,CAAO,iBACnB,GAAAF,aAAA,CAAK,QAAU,EAAA,KAAK,CACpB,GAAAI,aAAA,CAAKJ,aAAK,CAAA,QAAA,EAAU,KAAK,CAAA,EAAG,MAAM,KAAK,CAAA;AAC3C;AArDgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"slice.cjs","sourcesContent":["import { drop } from './drop';\nimport { dropLast } from './dropLast';\nimport { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { takeLast } from './takeLast';\n\n/**\n * Produces an iterable with the elements from the `start` index to the `end` index (exclusive).\n *\n * @param iterable The iterator to slice.\n * @param start The index at which to begin extraction.\n * @param end The index at which to end extraction.\n * @returns An iterator that contains the elements of the provided iterator from `start` to `end`.\n *\n * @example\n * ```typescript\n * import { slice } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(, 1, 3)]);\n * // Output: [2, 3]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2)]);\n * // Output: [4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2)]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, -1)]);\n * // Output: [3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2, -1)]);\n * // Output: [4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, 1)]);\n * // Output: []\n * ```\n *\n * @remarks\n *\n * This function consumes the input iterator based on the `start` and `end` values, therefore, you should not use the\n * original iterator after calling this function.\n */\nexport function slice<const ElementType>(iterable: IterableResolvable<ElementType>, start?: number, end?: number): IterableIterator<ElementType> {\n\t// https://tc39.es/ecma262/#sec-array.prototype.slice\n\tstart = toIntegerOrInfinityOrThrow(start ?? 0);\n\tif (start === Number.NEGATIVE_INFINITY) {\n\t\tstart = 0;\n\t}\n\n\t// 1. If end is not provided, `slice` behaves like `drop` or `takeLast`,\n\t// depending on the sign of `start`:\n\tif (end === undefined) {\n\t\treturn start >= 0 //\n\t\t\t? drop(iterable, start)\n\t\t\t: takeLast(iterable, -start);\n\t}\n\n\tend = toIntegerOrInfinityOrThrow(end);\n\t// 2. If end is negative:\n\tif (end < 0) {\n\t\t// 2.1. If `end` is `-Infinity`, end would be `0`, which will always\n\t\t// result on an empty iterator:\n\t\tif (end === Number.NEGATIVE_INFINITY) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.2. If start is positive, drop the last n elements:\n\t\tif (start === 0) {\n\t\t\treturn dropLast(iterable, -end);\n\t\t}\n\n\t\t// 2.3. If the start is positive, drop the first n elements and take the\n\t\t// last m elements:\n\t\tif (start >= 0) {\n\t\t\treturn dropLast(drop(iterable, start), -end);\n\t\t}\n\n\t\t// 2.4. If the start is the same or greater than the end, return an\n\t\t// empty iterator:\n\t\tif (start >= end) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.5. `start` and `end` are negative, take the elements between the\n\t\t// start and end:\n\t\treturn take(takeLast(iterable, -start), end - start);\n\t}\n\n\t// 3.0. If `start` is greater than or equal to `end`, return an empty iterator:\n\tif (start >= end) return empty();\n\n\t// 4.0. Otherwise, take the elements between `start` and `end`:\n\treturn end === Number.POSITIVE_INFINITY //\n\t\t? drop(iterable, start)\n\t\t: take(drop(iterable, start), end - start);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/slice.ts"],"names":["toIntegerOrInfinityOrThrow","drop","takeLast","empty","dropLast","take"],"mappings":";;;;;;;;;;;AAiEO,SAAS,KAAA,CAAyB,QAAA,EAA2C,KAAA,EAAgB,GAAA,EAA6C;AAEhJ,EAAA,KAAA,GAAQA,0DAAA,CAA2B,SAAS,CAAC,CAAA;AAC7C,EAAA,IAAI,KAAA,KAAU,OAAO,iBAAA,EAAmB;AACvC,IAAA,KAAA,GAAQ,CAAA;AAAA,EACT;AAIA,EAAA,IAAI,QAAQ,MAAA,EAAW;AACtB,IAAA,OAAO,KAAA,IAAS,IACbC,aAAA,CAAK,QAAA,EAAU,KAAK,CAAA,GACpBC,qBAAA,CAAS,QAAA,EAAU,CAAC,KAAK,CAAA;AAAA,EAC7B;AAEA,EAAA,GAAA,GAAMF,2DAA2B,GAAG,CAAA;AAEpC,EAAA,IAAI,MAAM,CAAA,EAAG;AAGZ,IAAA,IAAI,GAAA,KAAQ,OAAO,iBAAA,EAAmB;AACrC,MAAA,OAAOG,eAAA,EAAM;AAAA,IACd;AAGA,IAAA,IAAI,UAAU,CAAA,EAAG;AAChB,MAAA,OAAOC,qBAAA,CAAS,QAAA,EAAU,CAAC,GAAG,CAAA;AAAA,IAC/B;AAIA,IAAA,IAAI,SAAS,CAAA,EAAG;AACf,MAAA,OAAOA,sBAASH,aAAA,CAAK,QAAA,EAAU,KAAK,CAAA,EAAG,CAAC,GAAG,CAAA;AAAA,IAC5C;AAIA,IAAA,IAAI,SAAS,GAAA,EAAK;AACjB,MAAA,OAAOE,eAAA,EAAM;AAAA,IACd;AAIA,IAAA,OAAOE,cAAKH,qBAAA,CAAS,QAAA,EAAU,CAAC,KAAK,CAAA,EAAG,MAAM,KAAK,CAAA;AAAA,EACpD;AAGA,EAAA,IAAI,KAAA,IAAS,GAAA,EAAK,OAAOC,eAAA,EAAM;AAG/B,EAAA,OAAO,GAAA,KAAQ,MAAA,CAAO,iBAAA,GACnBF,aAAA,CAAK,QAAA,EAAU,KAAK,CAAA,GACpBI,aAAA,CAAKJ,aAAA,CAAK,QAAA,EAAU,KAAK,CAAA,EAAG,MAAM,KAAK,CAAA;AAC3C;AArDgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"slice.cjs","sourcesContent":["import { drop } from './drop';\nimport { dropLast } from './dropLast';\nimport { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { takeLast } from './takeLast';\n\n/**\n * Produces an iterable with the elements from the `start` index to the `end` index (exclusive).\n *\n * @param iterable The iterator to slice.\n * @param start The index at which to begin extraction.\n * @param end The index at which to end extraction.\n * @returns An iterator that contains the elements of the provided iterator from `start` to `end`.\n *\n * @example\n * ```typescript\n * import { slice } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(, 1, 3)]);\n * // Output: [2, 3]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2)]);\n * // Output: [4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2)]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, -1)]);\n * // Output: [3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2, -1)]);\n * // Output: [4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, 1)]);\n * // Output: []\n * ```\n *\n * @remarks\n *\n * This function consumes the input iterator based on the `start` and `end` values, therefore, you should not use the\n * original iterator after calling this function.\n */\nexport function slice<const ElementType>(iterable: IterableResolvable<ElementType>, start?: number, end?: number): IterableIterator<ElementType> {\n\t// https://tc39.es/ecma262/#sec-array.prototype.slice\n\tstart = toIntegerOrInfinityOrThrow(start ?? 0);\n\tif (start === Number.NEGATIVE_INFINITY) {\n\t\tstart = 0;\n\t}\n\n\t// 1. If end is not provided, `slice` behaves like `drop` or `takeLast`,\n\t// depending on the sign of `start`:\n\tif (end === undefined) {\n\t\treturn start >= 0 //\n\t\t\t? drop(iterable, start)\n\t\t\t: takeLast(iterable, -start);\n\t}\n\n\tend = toIntegerOrInfinityOrThrow(end);\n\t// 2. If end is negative:\n\tif (end < 0) {\n\t\t// 2.1. If `end` is `-Infinity`, end would be `0`, which will always\n\t\t// result on an empty iterator:\n\t\tif (end === Number.NEGATIVE_INFINITY) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.2. If start is positive, drop the last n elements:\n\t\tif (start === 0) {\n\t\t\treturn dropLast(iterable, -end);\n\t\t}\n\n\t\t// 2.3. If the start is positive, drop the first n elements and take the\n\t\t// last m elements:\n\t\tif (start >= 0) {\n\t\t\treturn dropLast(drop(iterable, start), -end);\n\t\t}\n\n\t\t// 2.4. If the start is the same or greater than the end, return an\n\t\t// empty iterator:\n\t\tif (start >= end) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.5. `start` and `end` are negative, take the elements between the\n\t\t// start and end:\n\t\treturn take(takeLast(iterable, -start), end - start);\n\t}\n\n\t// 3.0. If `start` is greater than or equal to `end`, return an empty iterator:\n\tif (start >= end) return empty();\n\n\t// 4.0. Otherwise, take the elements between `start` and `end`:\n\treturn end === Number.POSITIVE_INFINITY //\n\t\t? drop(iterable, start)\n\t\t: take(drop(iterable, start), end - start);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/some.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAgCO,SAAS,IAAA,CACf,UACA,UACU,EAAA;AACV,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAI,IAAA,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,CAAG,EAAA;AAC/B,MAAO,OAAA,IAAA;AAAA;AACR;AAGD,EAAO,OAAA,KAAA;AACR;AAdgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"some.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds a matching element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to\n * indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if the callback function returns a truthy value for at least one element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { some } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 2 === 0));\n * // Output: true\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 6 === 0));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function some<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/some.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAgCO,SAAS,IAAA,CACf,UACA,UAAA,EACU;AACV,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,KAAA,IAASC,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,IAAA,IAAI,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,CAAA,EAAG;AAC/B,MAAA,OAAO,IAAA;AAAA,IACR;AAAA,EACD;AAEA,EAAA,OAAO,KAAA;AACR;AAdgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"some.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds a matching element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to\n * indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if the callback function returns a truthy value for at least one element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { some } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 2 === 0));\n * // Output: true\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 6 === 0));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function some<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/sorted.ts"],"names":["toArray"],"mappings":";;;;;;AAuBO,SAAS,MAAA,CACf,UACA,SACgC,EAAA;AAChC,EAAA,OAAOA,oBAAQ,QAAQ,CAAA,CAAE,IAAK,CAAA,SAAS,EAAE,MAAO,EAAA;AACjD;AALgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"sorted.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements sorted.\n *\n * @param iterable An iterator to sort.\n * @param compareFn A function that defines the sort order. If omitted, the values are sorted in ascending order.\n * @returns An iterator that yields the values of the provided iterator in sorted order.\n *\n * @example\n * ```typescript\n * import { sorted } from '@sapphire/iterator-utilities';\n *\n * const iterable = [5, 3, 1, 4, 2];\n * console.log([...sorted(iterable)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire input iterator.\n */\nexport function sorted<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcompareFn?: (a: ElementType, b: ElementType) => number\n): IterableIterator<ElementType> {\n\treturn toArray(iterable).sort(compareFn).values();\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/sorted.ts"],"names":["toArray"],"mappings":";;;;;;AAuBO,SAAS,MAAA,CACf,UACA,SAAA,EACgC;AAChC,EAAA,OAAOA,oBAAQ,QAAQ,CAAA,CAAE,IAAA,CAAK,SAAS,EAAE,MAAA,EAAO;AACjD;AALgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"sorted.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements sorted.\n *\n * @param iterable An iterator to sort.\n * @param compareFn A function that defines the sort order. If omitted, the values are sorted in ascending order.\n * @returns An iterator that yields the values of the provided iterator in sorted order.\n *\n * @example\n * ```typescript\n * import { sorted } from '@sapphire/iterator-utilities';\n *\n * const iterable = [5, 3, 1, 4, 2];\n * console.log([...sorted(iterable)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire input iterator.\n */\nexport function sorted<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcompareFn?: (a: ElementType, b: ElementType) => number\n): IterableIterator<ElementType> {\n\treturn toArray(iterable).sort(compareFn).values();\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/starMap.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;;AA0BO,UAAU,OAAA,CAChB,UACA,UAC+B,EAAA;AAC/B,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,MAAM,UAAW,CAAA,GAAIA,yCAAmB,CAAA,KAAK,CAAS,CAAA;AAAA;AAExD;AATiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"starMap.cjs","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 of the input iterables as the function's parameters.\n *\n * @param iterable The iterable to map over.\n * @param callbackFn The callback function to apply to each element.\n * @returns An iterable iterator that yields the mapped elements.\n *\n * @example\n * ```typescript\n * import { starMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [[1, 2], [3, 4], [5, 6]];\n * console.log([...starMap(iterable, (a, b) => a + b)]);\n * // Output: [3, 7, 11]\n * ```\n *\n * @remarks\n *\n * While very similar to {@link map}, `starMap` takes an iterable of iterables (which can be an array of tuples) and\n * calls the function with each inner iterable's values as the function's parameters. {@link map} calls the function\n * with the value and the index by comparison.\n */\nexport function* starMap<const ElementType extends IterableResolvable<any>, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (...args: StarMapParameters<ElementType>) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield callbackFn(...(toIterableIterator(value) as any));\n\t}\n}\n\nexport type StarMapParameters<ElementType> = ElementType extends readonly [...infer ElementTypeEntry]\n\t? ElementTypeEntry\n\t: ElementType extends IterableResolvable<infer ElementType>\n\t\t? ElementType[]\n\t\t: never;\n"]}
1
+ {"version":3,"sources":["../../../src/lib/starMap.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;;AA0BO,UAAU,OAAA,CAChB,UACA,UAAA,EAC+B;AAC/B,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,KAAA,MAAW,KAAA,IAASC,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,IAAA,MAAM,UAAA,CAAW,GAAIA,yCAAA,CAAmB,KAAK,CAAS,CAAA;AAAA,EACvD;AACD;AATiB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"starMap.cjs","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 of the input iterables as the function's parameters.\n *\n * @param iterable The iterable to map over.\n * @param callbackFn The callback function to apply to each element.\n * @returns An iterable iterator that yields the mapped elements.\n *\n * @example\n * ```typescript\n * import { starMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [[1, 2], [3, 4], [5, 6]];\n * console.log([...starMap(iterable, (a, b) => a + b)]);\n * // Output: [3, 7, 11]\n * ```\n *\n * @remarks\n *\n * While very similar to {@link map}, `starMap` takes an iterable of iterables (which can be an array of tuples) and\n * calls the function with each inner iterable's values as the function's parameters. {@link map} calls the function\n * with the value and the index by comparison.\n */\nexport function* starMap<const ElementType extends IterableResolvable<any>, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (...args: StarMapParameters<ElementType>) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield callbackFn(...(toIterableIterator(value) as any));\n\t}\n}\n\nexport type StarMapParameters<ElementType> = ElementType extends readonly [...infer ElementTypeEntry]\n\t? ElementTypeEntry\n\t: ElementType extends IterableResolvable<infer ElementType>\n\t\t? ElementType[]\n\t\t: never;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/stepBy.ts"],"names":["assertPositive","toIntegerOrInfinityOrThrow","from","makeIterableIterator","result"],"mappings":";;;;;;;;;AAwBO,SAAS,MAAA,CAA0B,UAA2C,IAA6C,EAAA;AACjI,EAAA,IAAA,GAAOA,kCAAe,CAAAC,0DAAA,CAA2B,IAAI,CAAA,EAAG,IAAI,CAAA;AAE5D,EAAM,MAAA,QAAA,GAAWC,cAAK,QAAQ,CAAA;AAC9B,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,IAAA,IAAI,OAAO,IAAM,EAAA;AAChB,MAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,MAAU,EAAA;AAAA;AAGvC,IAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,IAAA,GAAO,GAAG,CAAK,EAAA,EAAA;AAClC,MAAMC,MAAAA,OAAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,MAAA,IAAIA,QAAO,IAAM,EAAA;AAAA;AAGlB,IAAA,OAAO,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAO,OAAO,KAAM,EAAA;AAAA,GAC1C,CAAA;AACF;AAjBgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"stepBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertPositive } from './shared/_assertPositive';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Creates an iterator starting at the same point, but stepping by the given amount at each iteration.\n *\n * @param iterable An iterator to map over.\n * @param step A positive integer representing the step to take at each iteration.\n *\n * @example\n * ```typescript\n * import { stepBy } from '@sapphire/iterator-utilities';\n *\n * const iterable = [0, 1, 2, 3, 4, 5];\n * console.log([...stepBy(iterable, 2)]);\n * // Output: [0, 2, 4]\n * ```\n *\n * @remarks\n *\n * The first element of the iterator will always be returned, regardless of the step given.\n */\nexport function stepBy<const ElementType>(iterable: IterableResolvable<ElementType>, step: number): IterableIterator<ElementType> {\n\tstep = assertPositive(toIntegerOrInfinityOrThrow(step), step);\n\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tconst result = iterator.next();\n\t\tif (result.done) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\tfor (let i = 0; i < step - 1; i++) {\n\t\t\tconst result = iterator.next();\n\t\t\tif (result.done) break;\n\t\t}\n\n\t\treturn { done: false, value: result.value };\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/stepBy.ts"],"names":["assertPositive","toIntegerOrInfinityOrThrow","from","makeIterableIterator","result"],"mappings":";;;;;;;;;AAwBO,SAAS,MAAA,CAA0B,UAA2C,IAAA,EAA6C;AACjI,EAAA,IAAA,GAAOA,kCAAA,CAAeC,0DAAA,CAA2B,IAAI,CAAA,EAAG,IAAI,CAAA;AAE5D,EAAA,MAAM,QAAA,GAAWC,cAAK,QAAQ,CAAA;AAC9B,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,IAAA,IAAI,OAAO,IAAA,EAAM;AAChB,MAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU;AAAA,IACvC;AAEA,IAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,IAAA,GAAO,GAAG,CAAA,EAAA,EAAK;AAClC,MAAA,MAAMC,OAAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,MAAA,IAAIA,QAAO,IAAA,EAAM;AAAA,IAClB;AAEA,IAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,OAAO,KAAA,EAAM;AAAA,EAC3C,CAAC,CAAA;AACF;AAjBgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"stepBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertPositive } from './shared/_assertPositive';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Creates an iterator starting at the same point, but stepping by the given amount at each iteration.\n *\n * @param iterable An iterator to map over.\n * @param step A positive integer representing the step to take at each iteration.\n *\n * @example\n * ```typescript\n * import { stepBy } from '@sapphire/iterator-utilities';\n *\n * const iterable = [0, 1, 2, 3, 4, 5];\n * console.log([...stepBy(iterable, 2)]);\n * // Output: [0, 2, 4]\n * ```\n *\n * @remarks\n *\n * The first element of the iterator will always be returned, regardless of the step given.\n */\nexport function stepBy<const ElementType>(iterable: IterableResolvable<ElementType>, step: number): IterableIterator<ElementType> {\n\tstep = assertPositive(toIntegerOrInfinityOrThrow(step), step);\n\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tconst result = iterator.next();\n\t\tif (result.done) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\tfor (let i = 0; i < step - 1; i++) {\n\t\t\tconst result = iterator.next();\n\t\t\tif (result.done) break;\n\t\t}\n\n\t\treturn { done: false, value: result.value };\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/sum.ts"],"names":["sum","map","toNumberOrThrow"],"mappings":";;;;;;;AAuBO,SAAS,IAAI,QAAgD,EAAA;AACnE,EAAA,IAAIA,IAAM,GAAA,CAAA;AACV,EAAA,KAAA,MAAW,KAAS,IAAAC,WAAA,CAAI,QAAU,EAAAC,oCAAe,CAAG,EAAA;AACnD,IAAAF,IAAO,IAAA,KAAA;AAAA;AAGR,EAAOA,OAAAA,IAAAA;AACR;AAPgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"sum.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow, type NumberResolvable } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the sum of all the elements.\n *\n * @param iterable An iterator of numbers to calculate the sum of.\n * @returns The sum of the numbers in the input iterator.\n *\n * @example\n * ```typescript\n * import { sum } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(sum(iterable));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function sum(iterable: IterableResolvable<NumberResolvable>) {\n\tlet sum = 0;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tsum += value;\n\t}\n\n\treturn sum;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/sum.ts"],"names":["sum","map","toNumberOrThrow"],"mappings":";;;;;;;AAuBO,SAAS,IAAI,QAAA,EAAgD;AACnE,EAAA,IAAIA,IAAAA,GAAM,CAAA;AACV,EAAA,KAAA,MAAW,KAAA,IAASC,WAAA,CAAI,QAAA,EAAUC,oCAAe,CAAA,EAAG;AACnD,IAAAF,IAAAA,IAAO,KAAA;AAAA,EACR;AAEA,EAAA,OAAOA,IAAAA;AACR;AAPgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"sum.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow, type NumberResolvable } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the sum of all the elements.\n *\n * @param iterable An iterator of numbers to calculate the sum of.\n * @returns The sum of the numbers in the input iterator.\n *\n * @example\n * ```typescript\n * import { sum } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(sum(iterable));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function sum(iterable: IterableResolvable<NumberResolvable>) {\n\tlet sum = 0;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tsum += value;\n\t}\n\n\treturn sum;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/take.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","empty","from","makeIterableIterator"],"mappings":";;;;;;;;;;AAsBO,SAAS,IAAA,CAAwB,UAA2C,KAA8C,EAAA;AAChI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAI,IAAA,KAAA,KAAU,CAAG,EAAA,OAAOC,eAAM,EAAA;AAE9B,EAAA,IAAI,CAAI,GAAA,CAAA;AACR,EAAM,MAAA,gBAAA,GAAmBC,cAAK,QAAQ,CAAA;AACtC,EAAO,OAAAC,8CAAA;AAAA,IAAkC,MACxC,CAAK,IAAA,KAAA,GACF,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,MAAU,EAAA,IAC9B,CAAK,EAAA,EAAA,gBAAA,CAAiB,IAAK,EAAA;AAAA,GAChC;AACD;AAXgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"take.cjs","sourcesContent":["import { empty } from './empty';\nimport { from, type IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Creates an iterable with the first `count` elements.\n *\n * @param iterable The iterator to take values from.\n * @param count The maximum number of values to take from the iterator.\n * @returns An iterator that yields at most `count` values from the provided iterator.\n *\n * @example\n * ```typescript\n * import { take } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...take(iterable, 2)]);\n * // Output: [1, 2]\n * ```\n */\nexport function take<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\n\tlet i = 0;\n\tconst resolvedIterable = from(iterable);\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, resolvedIterable.next())\n\t);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/take.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","empty","from","makeIterableIterator"],"mappings":";;;;;;;;;;AAsBO,SAAS,IAAA,CAAwB,UAA2C,KAAA,EAA8C;AAChI,EAAA,KAAA,GAAQA,wCAAA,CAAkBC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAOC,eAAA,EAAM;AAE9B,EAAA,IAAI,CAAA,GAAI,CAAA;AACR,EAAA,MAAM,gBAAA,GAAmBC,cAAK,QAAQ,CAAA;AACtC,EAAA,OAAOC,8CAAA;AAAA,IAAkC,MACxC,CAAA,IAAK,KAAA,GACF,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU,IAC9B,CAAA,EAAA,EAAK,gBAAA,CAAiB,IAAA,EAAK;AAAA,GAChC;AACD;AAXgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"take.cjs","sourcesContent":["import { empty } from './empty';\nimport { from, type IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Creates an iterable with the first `count` elements.\n *\n * @param iterable The iterator to take values from.\n * @param count The maximum number of values to take from the iterator.\n * @returns An iterator that yields at most `count` values from the provided iterator.\n *\n * @example\n * ```typescript\n * import { take } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...take(iterable, 2)]);\n * // Output: [1, 2]\n * ```\n */\nexport function take<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\n\tlet i = 0;\n\tconst resolvedIterable = from(iterable);\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, resolvedIterable.next())\n\t);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/takeLast.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","empty","toIterableIterator","toArray","makeIterableIterator"],"mappings":";;;;;;;;;;;AA4BO,SAAS,QAAA,CAA4B,UAA2C,KAA8C,EAAA;AACpI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAI,IAAA,KAAA,KAAU,CAAG,EAAA,OAAOC,eAAM,EAAA;AAC9B,EAAA,IAAI,KAAU,KAAA,MAAA,CAAO,iBAAmB,EAAA,OAAOC,0CAAmB,QAAQ,CAAA;AAE1E,EAAM,MAAA,KAAA,GAAQC,oBAAQ,QAAQ,CAAA;AAC9B,EAAA,IAAI,IAAI,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AACxC,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAI,IAAA,CAAA,IAAK,MAAM,MAAQ,EAAA;AACtB,MAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,MAAU,EAAA;AAAA;AAGvC,IAAA,OAAO,EAAE,IAAM,EAAA,KAAA,EAAO,KAAO,EAAA,KAAA,CAAM,GAAG,CAAE,EAAA;AAAA,GACxC,CAAA;AACF;AAdgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"takeLast.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toArray } from './toArray';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns a new iterable with the last `count` elements.\n *\n * @param iterable An iterator to take values from.\n * @param count The number of values to take from the end of the iterator.\n * @returns An iterator that contains the last `count` elements of the provided iterator.\n *\n * @example\n * ```typescript\n * import { takeLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...takeLast(iterable, 2)]);\n * // Output: [4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function takeLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\tif (count === Number.POSITIVE_INFINITY) return toIterableIterator(iterable);\n\n\tconst array = toArray(iterable);\n\tlet i = Math.max(0, array.length - count);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (i >= array.length) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\treturn { done: false, value: array[i++] };\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/takeLast.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","empty","toIterableIterator","toArray","makeIterableIterator"],"mappings":";;;;;;;;;;;AA4BO,SAAS,QAAA,CAA4B,UAA2C,KAAA,EAA8C;AACpI,EAAA,KAAA,GAAQA,wCAAA,CAAkBC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAOC,eAAA,EAAM;AAC9B,EAAA,IAAI,KAAA,KAAU,MAAA,CAAO,iBAAA,EAAmB,OAAOC,0CAAmB,QAAQ,CAAA;AAE1E,EAAA,MAAM,KAAA,GAAQC,oBAAQ,QAAQ,CAAA;AAC9B,EAAA,IAAI,IAAI,IAAA,CAAK,GAAA,CAAI,CAAA,EAAG,KAAA,CAAM,SAAS,KAAK,CAAA;AACxC,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAA,IAAI,CAAA,IAAK,MAAM,MAAA,EAAQ;AACtB,MAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU;AAAA,IACvC;AAEA,IAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,KAAA,CAAM,GAAG,CAAA,EAAE;AAAA,EACzC,CAAC,CAAA;AACF;AAdgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"takeLast.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toArray } from './toArray';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns a new iterable with the last `count` elements.\n *\n * @param iterable An iterator to take values from.\n * @param count The number of values to take from the end of the iterator.\n * @returns An iterator that contains the last `count` elements of the provided iterator.\n *\n * @example\n * ```typescript\n * import { takeLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...takeLast(iterable, 2)]);\n * // Output: [4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function takeLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\tif (count === Number.POSITIVE_INFINITY) return toIterableIterator(iterable);\n\n\tconst array = toArray(iterable);\n\tlet i = Math.max(0, array.length - count);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (i >= array.length) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\treturn { done: false, value: array[i++] };\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/tee.ts"],"names":["assertNotNegative","toIntegerOrThrow","toArray","repeat","from","iterable","makeIterableIterator"],"mappings":";;;;;;;;;;;AA2BO,SAAS,GAAA,CAAuB,UAA2C,KAAgD,EAAA;AACjI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,sCAAA,CAAiB,KAAK,CAAA,EAAG,KAAK,CAAA;AACxD,EAAI,IAAA,KAAA,KAAU,CAAG,EAAA,OAAO,EAAC;AAEzB,EAAA,MAAM,UAAU,EAAC;AACjB,EAAA,MAAM,OAAU,GAAAC,mBAAA,CAAQC,iBAAO,CAAA,CAAA,EAAG,KAAK,CAAC,CAAA;AACxC,EAAM,MAAA,gBAAA,GAAmBC,cAAK,QAAQ,CAAA;AAEtC,EAAA,MAAM,YAAY,EAAC;AACnB,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,EAAO,CAAK,EAAA,EAAA;AAC/B,IAAMC,MAAAA,SAAAA,GAAWC,+CAAkC,MAAM;AACxD,MAAA,IAAI,OAAQ,CAAA,CAAC,CAAK,IAAA,OAAA,CAAQ,MAAQ,EAAA;AACjC,QAAM,MAAA,MAAA,GAAS,iBAAiB,IAAK,EAAA;AACrC,QAAA,IAAI,OAAO,IAAM,EAAA;AAChB,UAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,MAAU,EAAA;AAAA;AAGvC,QAAQ,OAAA,CAAA,IAAA,CAAK,OAAO,KAAK,CAAA;AAAA;AAG1B,MAAO,OAAA,EAAE,MAAM,KAAO,EAAA,KAAA,EAAO,QAAQ,OAAQ,CAAA,CAAC,GAAG,CAAE,EAAA;AAAA,KACnD,CAAA;AAED,IAAA,SAAA,CAAU,KAAKD,SAAQ,CAAA;AAAA;AAGxB,EAAO,OAAA,SAAA;AACR;AA3BgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"tee.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { repeat } from './repeat';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrThrow } from './shared/_toIntegerOrThrow';\nimport { toArray } from './toArray';\n\n/**\n * Creates `count` independent iterators from the input iterable.\n *\n * @param iterable An iterator to tee.\n * @param count The number of iterators to create.\n * @returns An array of `count` iterators that each yield the same values as the input iterator.\n *\n * @example\n * ```typescript\n * import { tee } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [iter1, iter2] = tee(iterable, 2);\n * console.log([...iter1]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * console.log([...iter2]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function tee<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType>[] {\n\tcount = assertNotNegative(toIntegerOrThrow(count), count);\n\tif (count === 0) return [];\n\n\tconst entries = [] as ElementType[];\n\tconst indexes = toArray(repeat(0, count));\n\tconst resolvedIterable = from(iterable);\n\n\tconst iterables = [] as IterableIterator<ElementType>[];\n\tfor (let i = 0; i < count; i++) {\n\t\tconst iterable = makeIterableIterator<ElementType>(() => {\n\t\t\tif (indexes[i] >= entries.length) {\n\t\t\t\tconst result = resolvedIterable.next();\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t}\n\n\t\t\t\tentries.push(result.value);\n\t\t\t}\n\n\t\t\treturn { done: false, value: entries[indexes[i]++] };\n\t\t});\n\n\t\titerables.push(iterable);\n\t}\n\n\treturn iterables;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/tee.ts"],"names":["assertNotNegative","toIntegerOrThrow","toArray","repeat","from","iterable","makeIterableIterator"],"mappings":";;;;;;;;;;;AA2BO,SAAS,GAAA,CAAuB,UAA2C,KAAA,EAAgD;AACjI,EAAA,KAAA,GAAQA,wCAAA,CAAkBC,sCAAA,CAAiB,KAAK,CAAA,EAAG,KAAK,CAAA;AACxD,EAAA,IAAI,KAAA,KAAU,CAAA,EAAG,OAAO,EAAC;AAEzB,EAAA,MAAM,UAAU,EAAC;AACjB,EAAA,MAAM,OAAA,GAAUC,mBAAA,CAAQC,iBAAA,CAAO,CAAA,EAAG,KAAK,CAAC,CAAA;AACxC,EAAA,MAAM,gBAAA,GAAmBC,cAAK,QAAQ,CAAA;AAEtC,EAAA,MAAM,YAAY,EAAC;AACnB,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,KAAA,EAAO,CAAA,EAAA,EAAK;AAC/B,IAAA,MAAMC,SAAAA,GAAWC,+CAAkC,MAAM;AACxD,MAAA,IAAI,OAAA,CAAQ,CAAC,CAAA,IAAK,OAAA,CAAQ,MAAA,EAAQ;AACjC,QAAA,MAAM,MAAA,GAAS,iBAAiB,IAAA,EAAK;AACrC,QAAA,IAAI,OAAO,IAAA,EAAM;AAChB,UAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU;AAAA,QACvC;AAEA,QAAA,OAAA,CAAQ,IAAA,CAAK,OAAO,KAAK,CAAA;AAAA,MAC1B;AAEA,MAAA,OAAO,EAAE,MAAM,KAAA,EAAO,KAAA,EAAO,QAAQ,OAAA,CAAQ,CAAC,GAAG,CAAA,EAAE;AAAA,IACpD,CAAC,CAAA;AAED,IAAA,SAAA,CAAU,KAAKD,SAAQ,CAAA;AAAA,EACxB;AAEA,EAAA,OAAO,SAAA;AACR;AA3BgB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"tee.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { repeat } from './repeat';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrThrow } from './shared/_toIntegerOrThrow';\nimport { toArray } from './toArray';\n\n/**\n * Creates `count` independent iterators from the input iterable.\n *\n * @param iterable An iterator to tee.\n * @param count The number of iterators to create.\n * @returns An array of `count` iterators that each yield the same values as the input iterator.\n *\n * @example\n * ```typescript\n * import { tee } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [iter1, iter2] = tee(iterable, 2);\n * console.log([...iter1]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * console.log([...iter2]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function tee<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType>[] {\n\tcount = assertNotNegative(toIntegerOrThrow(count), count);\n\tif (count === 0) return [];\n\n\tconst entries = [] as ElementType[];\n\tconst indexes = toArray(repeat(0, count));\n\tconst resolvedIterable = from(iterable);\n\n\tconst iterables = [] as IterableIterator<ElementType>[];\n\tfor (let i = 0; i < count; i++) {\n\t\tconst iterable = makeIterableIterator<ElementType>(() => {\n\t\t\tif (indexes[i] >= entries.length) {\n\t\t\t\tconst result = resolvedIterable.next();\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t}\n\n\t\t\t\tentries.push(result.value);\n\t\t\t}\n\n\t\t\treturn { done: false, value: entries[indexes[i]++] };\n\t\t});\n\n\t\titerables.push(iterable);\n\t}\n\n\treturn iterables;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/toArray.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkCO,SAAS,QAA2B,QAA0D,EAAA;AACpG,EAAA,OAAO,CAAC,GAAGA,yCAAmB,CAAA,QAAQ,CAAC,CAAA;AACxC;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"toArray.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns an array with all the elements.\n *\n * @param iterable The iterator to convert to an array.\n * @returns An array containing the values of the provided iterator.\n *\n * @example\n * ```typescript\n * import { toArray } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log(toArray(array));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log(toArray(set));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log(toArray(map));\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log(toArray(string));\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function toArray<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType[] {\n\treturn [...toIterableIterator(iterable)];\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/toArray.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkCO,SAAS,QAA2B,QAAA,EAA0D;AACpG,EAAA,OAAO,CAAC,GAAGA,yCAAA,CAAmB,QAAQ,CAAC,CAAA;AACxC;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"toArray.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns an array with all the elements.\n *\n * @param iterable The iterator to convert to an array.\n * @returns An array containing the values of the provided iterator.\n *\n * @example\n * ```typescript\n * import { toArray } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log(toArray(array));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log(toArray(set));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log(toArray(map));\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log(toArray(string));\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function toArray<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType[] {\n\treturn [...toIterableIterator(iterable)];\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/toIterableIterator.ts"],"names":["from","makeIterableIterator"],"mappings":";;;;;;;AA8BO,SAAS,mBAAsC,QAA0E,EAAA;AAC/H,EAAM,MAAA,gBAAA,GAAmBA,cAAK,QAAQ,CAAA;AACtC,EAAI,IAAA,MAAA,CAAO,YAAY,gBAAkB,EAAA;AACxC,IAAO,OAAA,gBAAA;AAAA;AAGR,EAAA,OAAOC,8CAAqB,CAAA,MAAM,gBAAiB,CAAA,IAAA,EAAM,CAAA;AAC1D;AAPgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA","file":"toIterableIterator.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an iterable iterator from an iterable or iterator-like object.\n *\n * @param iterable The iterable or iterable-like object to convert.\n * @returns An iterable iterator.\n *\n * @example\n * ```typescript\n * import { toIterableIterator } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log([...toIterableIterator(array)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log([...toIterableIterator(set)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log([...toIterableIterator(map)]);\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log([...toIterableIterator(string)]);\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n */\nexport function toIterableIterator<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tif (Symbol.iterator in resolvedIterable) {\n\t\treturn resolvedIterable;\n\t}\n\n\treturn makeIterableIterator(() => resolvedIterable.next());\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/toIterableIterator.ts"],"names":["from","makeIterableIterator"],"mappings":";;;;;;;AA8BO,SAAS,mBAAsC,QAAA,EAA0E;AAC/H,EAAA,MAAM,gBAAA,GAAmBA,cAAK,QAAQ,CAAA;AACtC,EAAA,IAAI,MAAA,CAAO,YAAY,gBAAA,EAAkB;AACxC,IAAA,OAAO,gBAAA;AAAA,EACR;AAEA,EAAA,OAAOC,8CAAA,CAAqB,MAAM,gBAAA,CAAiB,IAAA,EAAM,CAAA;AAC1D;AAPgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA","file":"toIterableIterator.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an iterable iterator from an iterable or iterator-like object.\n *\n * @param iterable The iterable or iterable-like object to convert.\n * @returns An iterable iterator.\n *\n * @example\n * ```typescript\n * import { toIterableIterator } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log([...toIterableIterator(array)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log([...toIterableIterator(set)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log([...toIterableIterator(map)]);\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log([...toIterableIterator(string)]);\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n */\nexport function toIterableIterator<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tif (Symbol.iterator in resolvedIterable) {\n\t\treturn resolvedIterable;\n\t}\n\n\treturn makeIterableIterator(() => resolvedIterable.next());\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/union.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAmBO,UAAU,SAA4B,SAA6E,EAAA;AACzH,EAAM,MAAA,IAAA,uBAAW,GAAiB,EAAA;AAClC,EAAA,KAAA,MAAW,YAAY,SAAW,EAAA;AACjC,IAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,MAAA,IAAI,CAAC,IAAA,CAAK,GAAI,CAAA,KAAK,CAAG,EAAA;AACrB,QAAA,IAAA,CAAK,IAAI,KAAK,CAAA;AACd,QAAM,MAAA,KAAA;AAAA;AACP;AACD;AAEF;AAViB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"union.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in either input iterable.\n *\n * @param iterables The iterators to combine.\n * @returns An iterator that yields the union of the provided iterators.\n *\n * @example\n * ```typescript\n * import { union } from '@sapphire/iterator-utilities';\n *\n * const iterable1 = [1, 2, 3];\n * const iterable2 = [3, 4, 5];\n * console.log([...union(iterable1, iterable2)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function* union<const ElementType>(...iterables: IterableResolvable<ElementType>[]): IterableIterator<ElementType> {\n\tconst seen = new Set<ElementType>();\n\tfor (const iterator of iterables) {\n\t\tfor (const value of toIterableIterator(iterator)) {\n\t\t\tif (!seen.has(value)) {\n\t\t\t\tseen.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/union.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAmBO,UAAU,SAA4B,SAAA,EAA6E;AACzH,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAiB;AAClC,EAAA,KAAA,MAAW,YAAY,SAAA,EAAW;AACjC,IAAA,KAAA,MAAW,KAAA,IAASA,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,MAAA,IAAI,CAAC,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,EAAG;AACrB,QAAA,IAAA,CAAK,IAAI,KAAK,CAAA;AACd,QAAA,MAAM,KAAA;AAAA,MACP;AAAA,IACD;AAAA,EACD;AACD;AAViB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"union.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in either input iterable.\n *\n * @param iterables The iterators to combine.\n * @returns An iterator that yields the union of the provided iterators.\n *\n * @example\n * ```typescript\n * import { union } from '@sapphire/iterator-utilities';\n *\n * const iterable1 = [1, 2, 3];\n * const iterable2 = [3, 4, 5];\n * console.log([...union(iterable1, iterable2)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function* union<const ElementType>(...iterables: IterableResolvable<ElementType>[]): IterableIterator<ElementType> {\n\tconst seen = new Set<ElementType>();\n\tfor (const iterator of iterables) {\n\t\tfor (const value of toIterableIterator(iterator)) {\n\t\t\tif (!seen.has(value)) {\n\t\t\t\tseen.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t}\n\t}\n}\n"]}