@sapphire/iterator-utilities 2.1.0-next.e79994f1 → 2.1.0-next.ee9cdb94

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/append.ts"],"names":["chain"],"mappings":";;;;;;AAmBO,SAAS,MAAA,CACf,aACG,SAC6B,EAAA;AAChC,EAAO,OAAAA,eAAA,CAAM,QAAU,EAAA,GAAG,SAAS,CAAA;AACpC;AALgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"append.cjs","sourcesContent":["import { chain } from './chain';\nimport type { IterableResolvable } from './from';\n\n/**\n * Appends iterables to the end of the first iterable, returning a new iterable combining all of them. It's similar to concatenating arrays or doing `[...a, ...b, ...c]`.\n *\n * @param iterable The iterator to append values to.\n * @param iterables The iterables to append 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 { append } from '@sapphire/iterator-utilities';\n *\n * const iterable = append([1, 2, 3], [4, 5, 6], [7, 8, 9]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6, 7, 8, 9]\n * ```\n */\nexport function append<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\t...iterables: IterableResolvable<ElementType>[]\n): IterableIterator<ElementType> {\n\treturn chain(iterable, ...iterables);\n}\n\nexport { append as concat };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/append.ts"],"names":["chain"],"mappings":";;;;;;AAmBO,SAAS,MAAA,CACf,aACG,SAAA,EAC6B;AAChC,EAAA,OAAOA,eAAA,CAAM,QAAA,EAAU,GAAG,SAAS,CAAA;AACpC;AALgB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"append.cjs","sourcesContent":["import { chain } from './chain';\nimport type { IterableResolvable } from './from';\n\n/**\n * Appends iterables to the end of the first iterable, returning a new iterable combining all of them. It's similar to concatenating arrays or doing `[...a, ...b, ...c]`.\n *\n * @param iterable The iterator to append values to.\n * @param iterables The iterables to append 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 { append } from '@sapphire/iterator-utilities';\n *\n * const iterable = append([1, 2, 3], [4, 5, 6], [7, 8, 9]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6, 7, 8, 9]\n * ```\n */\nexport function append<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\t...iterables: IterableResolvable<ElementType>[]\n): IterableIterator<ElementType> {\n\treturn chain(iterable, ...iterables);\n}\n\nexport { append as concat };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/at.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","first","drop"],"mappings":";;;;;;;;;AA0BO,SAAS,EAAA,CAAsB,UAA2C,KAAwC,EAAA;AACxH,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAA,OAAOC,gBAAM,KAAU,KAAA,CAAA,GAAI,WAAWC,aAAK,CAAA,QAAA,EAAU,KAAK,CAAC,CAAA;AAC5D;AAHgB,MAAA,CAAA,EAAA,EAAA,IAAA,CAAA","file":"at.cjs","sourcesContent":["import { drop } from './drop';\nimport { first } from './first';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Advances the iterable to the `n`th element and returns it. If the iterable is exhausted before reaching the `n`th element, it returns `undefined`.\n *\n * @param iterable An iterator to return an element from.\n * @param index The index of the element to retrieve.\n * @returns The element at the specified index, or `undefined` if the index is out of range.\n *\n * @example\n * ```typescript\n * import { at } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(at(iterable, 2));\n * // Output: 3\n * ```\n *\n * @remarks\n *\n * This function consumes the input iterator up to the specified index.\n */\nexport function at<const ElementType>(iterable: IterableResolvable<ElementType>, index: number): ElementType | undefined {\n\tindex = assertNotNegative(toIntegerOrInfinityOrThrow(index), index);\n\treturn first(index === 0 ? iterable : drop(iterable, index));\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/at.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","first","drop"],"mappings":";;;;;;;;;AA0BO,SAAS,EAAA,CAAsB,UAA2C,KAAA,EAAwC;AACxH,EAAA,KAAA,GAAQA,wCAAA,CAAkBC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAA,OAAOC,gBAAM,KAAA,KAAU,CAAA,GAAI,WAAWC,aAAA,CAAK,QAAA,EAAU,KAAK,CAAC,CAAA;AAC5D;AAHgB,MAAA,CAAA,EAAA,EAAA,IAAA,CAAA","file":"at.cjs","sourcesContent":["import { drop } from './drop';\nimport { first } from './first';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Advances the iterable to the `n`th element and returns it. If the iterable is exhausted before reaching the `n`th element, it returns `undefined`.\n *\n * @param iterable An iterator to return an element from.\n * @param index The index of the element to retrieve.\n * @returns The element at the specified index, or `undefined` if the index is out of range.\n *\n * @example\n * ```typescript\n * import { at } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(at(iterable, 2));\n * // Output: 3\n * ```\n *\n * @remarks\n *\n * This function consumes the input iterator up to the specified index.\n */\nexport function at<const ElementType>(iterable: IterableResolvable<ElementType>, index: number): ElementType | undefined {\n\tindex = assertNotNegative(toIntegerOrInfinityOrThrow(index), index);\n\treturn first(index === 0 ? iterable : drop(iterable, index));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/average.ts"],"names":["map","toNumberOrThrow"],"mappings":";;;;;;;AAuBO,SAAS,QAAQ,QAA+D,EAAA;AACtF,EAAA,IAAI,GAAM,GAAA,CAAA;AACV,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAA,KAAA,MAAW,KAAS,IAAAA,WAAA,CAAI,QAAU,EAAAC,oCAAe,CAAG,EAAA;AACnD,IAAO,GAAA,IAAA,KAAA;AACP,IAAA,KAAA,EAAA;AAAA;AAGD,EAAO,OAAA,KAAA,KAAU,CAAI,GAAA,IAAA,GAAO,GAAM,GAAA,KAAA;AACnC;AATgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"average.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 average value of all the elements. If the iterable is empty, it returns `null`.\n *\n * @param iterable The iterator to calculate the average of.\n * @returns The average of the sequence of numbers, or `null` if the sequence is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { average } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(average(iterable));\n * // Output: 3\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function average(iterable: IterableResolvable<NumberResolvable>): number | null {\n\tlet sum = 0;\n\tlet total = 0;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tsum += value;\n\t\ttotal++;\n\t}\n\n\treturn total === 0 ? null : sum / total;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/average.ts"],"names":["map","toNumberOrThrow"],"mappings":";;;;;;;AAuBO,SAAS,QAAQ,QAAA,EAA+D;AACtF,EAAA,IAAI,GAAA,GAAM,CAAA;AACV,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,KAAA,IAASA,WAAA,CAAI,QAAA,EAAUC,oCAAe,CAAA,EAAG;AACnD,IAAA,GAAA,IAAO,KAAA;AACP,IAAA,KAAA,EAAA;AAAA,EACD;AAEA,EAAA,OAAO,KAAA,KAAU,CAAA,GAAI,IAAA,GAAO,GAAA,GAAM,KAAA;AACnC;AATgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"average.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 average value of all the elements. If the iterable is empty, it returns `null`.\n *\n * @param iterable The iterator to calculate the average of.\n * @returns The average of the sequence of numbers, or `null` if the sequence is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { average } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(average(iterable));\n * // Output: 3\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function average(iterable: IterableResolvable<NumberResolvable>): number | null {\n\tlet sum = 0;\n\tlet total = 0;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tsum += value;\n\t\ttotal++;\n\t}\n\n\treturn total === 0 ? null : sum / total;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/chain.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkBO,UAAU,SAA4B,SAA6E,EAAA;AACzH,EAAA,KAAA,MAAW,YAAY,SAAW,EAAA;AACjC,IAAA,OAAOA,0CAAmB,QAAQ,CAAA;AAAA;AAEpC;AAJiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"chain.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Similar to `append`, but takes an iterable of iterables and chains them together.\n *\n * @param iterables The iterators to chain together.\n * @returns An iterator that yields the values of the provided iterators in order.\n *\n * @example\n * ```typescript\n * import { chain } from '@sapphire/iterator-utilities';\n *\n * const iterable = chain([1, 2, 3], [4, 5, 6], [7, 8, 9]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6, 7, 8, 9]\n * ```\n */\nexport function* chain<const ElementType>(...iterables: IterableResolvable<ElementType>[]): IterableIterator<ElementType> {\n\tfor (const iterable of iterables) {\n\t\tyield* toIterableIterator(iterable);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/chain.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkBO,UAAU,SAA4B,SAAA,EAA6E;AACzH,EAAA,KAAA,MAAW,YAAY,SAAA,EAAW;AACjC,IAAA,OAAOA,0CAAmB,QAAQ,CAAA;AAAA,EACnC;AACD;AAJiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"chain.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Similar to `append`, but takes an iterable of iterables and chains them together.\n *\n * @param iterables The iterators to chain together.\n * @returns An iterator that yields the values of the provided iterators in order.\n *\n * @example\n * ```typescript\n * import { chain } from '@sapphire/iterator-utilities';\n *\n * const iterable = chain([1, 2, 3], [4, 5, 6], [7, 8, 9]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6, 7, 8, 9]\n * ```\n */\nexport function* chain<const ElementType>(...iterables: IterableResolvable<ElementType>[]): IterableIterator<ElementType> {\n\tfor (const iterable of iterables) {\n\t\tyield* toIterableIterator(iterable);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/chunk.ts"],"names":["assertPositive","toIntegerOrThrow","toIterableIterator"],"mappings":";;;;;;;;AAoBO,UAAU,KAAA,CAAyB,UAA2C,IAA+C,EAAA;AACnI,EAAA,IAAA,GAAOA,kCAAe,CAAAC,sCAAA,CAAiB,IAAI,CAAA,EAAG,IAAI,CAAA;AAElD,EAAA,IAAI,SAAwB,EAAC;AAC7B,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAA,MAAA,CAAO,KAAK,OAAO,CAAA;AAEnB,IAAI,IAAA,MAAA,CAAO,WAAW,IAAM,EAAA;AAC3B,MAAM,MAAA,MAAA;AACN,MAAA,MAAA,GAAS,EAAC;AAAA;AACX;AAGD,EAAA,IAAI,OAAO,MAAQ,EAAA;AAClB,IAAM,MAAA,MAAA;AAAA;AAER;AAhBiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"chunk.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertPositive } from './shared/_assertPositive';\nimport { toIntegerOrThrow } from './shared/_toIntegerOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Chunks the iterable into arrays of at most `size` elements.\n *\n * @param iterable The iterator whose elements to chunk.\n * @param size The maximum size of each chunk.\n *\n * @example\n * ```typescript\n * import { chunk } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...chunk(iterable, 2)]);\n * // Output: [[1, 2], [3, 4], [5]]\n * ```\n */\nexport function* chunk<const ElementType>(iterable: IterableResolvable<ElementType>, size: number): IterableIterator<ElementType[]> {\n\tsize = assertPositive(toIntegerOrThrow(size), size);\n\n\tlet buffer: ElementType[] = [];\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tbuffer.push(element);\n\n\t\tif (buffer.length === size) {\n\t\t\tyield buffer;\n\t\t\tbuffer = [];\n\t\t}\n\t}\n\n\tif (buffer.length) {\n\t\tyield buffer;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/chunk.ts"],"names":["assertPositive","toIntegerOrThrow","toIterableIterator"],"mappings":";;;;;;;;AAoBO,UAAU,KAAA,CAAyB,UAA2C,IAAA,EAA+C;AACnI,EAAA,IAAA,GAAOA,kCAAA,CAAeC,sCAAA,CAAiB,IAAI,CAAA,EAAG,IAAI,CAAA;AAElD,EAAA,IAAI,SAAwB,EAAC;AAC7B,EAAA,KAAA,MAAW,OAAA,IAAWC,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACnD,IAAA,MAAA,CAAO,KAAK,OAAO,CAAA;AAEnB,IAAA,IAAI,MAAA,CAAO,WAAW,IAAA,EAAM;AAC3B,MAAA,MAAM,MAAA;AACN,MAAA,MAAA,GAAS,EAAC;AAAA,IACX;AAAA,EACD;AAEA,EAAA,IAAI,OAAO,MAAA,EAAQ;AAClB,IAAA,MAAM,MAAA;AAAA,EACP;AACD;AAhBiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"chunk.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertPositive } from './shared/_assertPositive';\nimport { toIntegerOrThrow } from './shared/_toIntegerOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Chunks the iterable into arrays of at most `size` elements.\n *\n * @param iterable The iterator whose elements to chunk.\n * @param size The maximum size of each chunk.\n *\n * @example\n * ```typescript\n * import { chunk } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...chunk(iterable, 2)]);\n * // Output: [[1, 2], [3, 4], [5]]\n * ```\n */\nexport function* chunk<const ElementType>(iterable: IterableResolvable<ElementType>, size: number): IterableIterator<ElementType[]> {\n\tsize = assertPositive(toIntegerOrThrow(size), size);\n\n\tlet buffer: ElementType[] = [];\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tbuffer.push(element);\n\n\t\tif (buffer.length === size) {\n\t\t\tyield buffer;\n\t\t\tbuffer = [];\n\t\t}\n\t}\n\n\tif (buffer.length) {\n\t\tyield buffer;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/collectInto.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AA2BO,SAAS,WAAA,CAA+B,UAA2C,MAAsC,EAAA;AAC/H,EAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,MAAA,CAAO,KAAK,KAAK,CAAA;AAAA;AAGlB,EAAO,OAAA,MAAA;AACR;AANgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"collectInto.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Collects all the items from an iterator into an array.\n *\n * This method consumes the iterator and adds all its items to the passed array. The array is then returned, so the call\n * chain can be continued.\n *\n * This is useful when you already have a collection and want to add the iterator items to it.\n *\n * @param iterable An iterator to fuse.\n *\n * @example\n * ```typescript\n * import { collectInto, map } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3];\n * const output = [0, 1];\n *\n * collectInto(map(iterable, (value) => value * 2), output);\n * collectInto(map(iterable, (value) => value * 10), output);\n *\n * console.log(output);\n * // Output: [0, 1, 2, 4, 6, 10, 20, 30]\n * ```\n */\nexport function collectInto<const ElementType>(iterable: IterableResolvable<ElementType>, output: ElementType[]): ElementType[] {\n\tfor (const value of toIterableIterator(iterable)) {\n\t\toutput.push(value);\n\t}\n\n\treturn output;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/collectInto.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AA2BO,SAAS,WAAA,CAA+B,UAA2C,MAAA,EAAsC;AAC/H,EAAA,KAAA,MAAW,KAAA,IAASA,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,IAAA,MAAA,CAAO,KAAK,KAAK,CAAA;AAAA,EAClB;AAEA,EAAA,OAAO,MAAA;AACR;AANgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"collectInto.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Collects all the items from an iterator into an array.\n *\n * This method consumes the iterator and adds all its items to the passed array. The array is then returned, so the call\n * chain can be continued.\n *\n * This is useful when you already have a collection and want to add the iterator items to it.\n *\n * @param iterable An iterator to fuse.\n *\n * @example\n * ```typescript\n * import { collectInto, map } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3];\n * const output = [0, 1];\n *\n * collectInto(map(iterable, (value) => value * 2), output);\n * collectInto(map(iterable, (value) => value * 10), output);\n *\n * console.log(output);\n * // Output: [0, 1, 2, 4, 6, 10, 20, 30]\n * ```\n */\nexport function collectInto<const ElementType>(iterable: IterableResolvable<ElementType>, output: ElementType[]): ElementType[] {\n\tfor (const value of toIterableIterator(iterable)) {\n\t\toutput.push(value);\n\t}\n\n\treturn output;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/compact.ts"],"names":["filter"],"mappings":";;;;;;AAiBO,SAAS,QAA2B,QAA6F,EAAA;AACvI,EAAA,OAAOA,kBAAO,QAAU,EAAA,CAAC,UAAgC,KAAU,KAAA,IAAA,IAAQ,UAAU,MAAS,CAAA;AAC/F;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"compact.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\n\n/**\n * Creates a new iterable that yields all the non-nullish values (`null` and `undefined`) from the iterable.\n *\n * @param iterable An iterator that contains elements to be compacted.\n *\n * @example\n * ```typescript\n * import { compact } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, null, 2, undefined, 3];\n * console.log([...compact(iterable)]);\n * // Output: [1, 2, 3]\n * ```\n */\nexport function compact<const ElementType>(iterable: IterableResolvable<ElementType | null | undefined>): IterableIterator<ElementType> {\n\treturn filter(iterable, (value): value is ElementType => value !== null && value !== undefined);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/compact.ts"],"names":["filter"],"mappings":";;;;;;AAiBO,SAAS,QAA2B,QAAA,EAA6F;AACvI,EAAA,OAAOA,kBAAO,QAAA,EAAU,CAAC,UAAgC,KAAA,KAAU,IAAA,IAAQ,UAAU,MAAS,CAAA;AAC/F;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"compact.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\n\n/**\n * Creates a new iterable that yields all the non-nullish values (`null` and `undefined`) from the iterable.\n *\n * @param iterable An iterator that contains elements to be compacted.\n *\n * @example\n * ```typescript\n * import { compact } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, null, 2, undefined, 3];\n * console.log([...compact(iterable)]);\n * // Output: [1, 2, 3]\n * ```\n */\nexport function compact<const ElementType>(iterable: IterableResolvable<ElementType | null | undefined>): IterableIterator<ElementType> {\n\treturn filter(iterable, (value): value is ElementType => value !== null && value !== undefined);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/compare.ts"],"names":["compareBy","defaultCompare"],"mappings":";;;;;;;AA+BO,SAAS,OAAA,CACf,UACA,KAC0B,EAAA;AAC1B,EAAO,OAAAA,uBAAA,CAAU,QAAU,EAAA,KAAA,EAAOC,8BAAc,CAAA;AACjD;AALgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"compare.cjs","sourcesContent":["import { compareBy } from './compareBy';\nimport type { IterableResolvable } from './from';\nimport type { LexicographicComparison } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * {@link LexicographicComparison Lexicographically} compares the elements of both iterators are equal.\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 compareBy} instead.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { compare } from '@sapphire/iterator-utilities';\n *\n * console.log(compare([1], [1]));\n * // Output: 0\n * console.log(compare([1], [1, 2]));\n * // Output: -1\n * console.log(compare([1, 2], [1]));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function compare<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tother: IterableResolvable<ElementType>\n): LexicographicComparison {\n\treturn compareBy(iterable, other, defaultCompare);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/compare.ts"],"names":["compareBy","defaultCompare"],"mappings":";;;;;;;AA+BO,SAAS,OAAA,CACf,UACA,KAAA,EAC0B;AAC1B,EAAA,OAAOA,uBAAA,CAAU,QAAA,EAAU,KAAA,EAAOC,8BAAc,CAAA;AACjD;AALgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"compare.cjs","sourcesContent":["import { compareBy } from './compareBy';\nimport type { IterableResolvable } from './from';\nimport type { LexicographicComparison } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * {@link LexicographicComparison Lexicographically} compares the elements of both iterators are equal.\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 compareBy} instead.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { compare } from '@sapphire/iterator-utilities';\n *\n * console.log(compare([1], [1]));\n * // Output: 0\n * console.log(compare([1], [1, 2]));\n * // Output: -1\n * console.log(compare([1, 2], [1]));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function compare<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tother: IterableResolvable<ElementType>\n): LexicographicComparison {\n\treturn compareBy(iterable, other, defaultCompare);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/compareBy.ts"],"names":["from","toIterableIterator","compareIteratorElements","orderingIsEqual","orderingIsLess"],"mappings":";;;;;;;;AA6BO,SAAS,SAAA,CACf,QACA,EAAA,KAAA,EACA,UAC0B,EAAA;AAC1B,EAAM,MAAA,SAAA,GAAYA,cAAK,KAAK,CAAA;AAE5B,EAAW,KAAA,MAAA,CAAA,IAAKC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AAC7C,IAAM,MAAA,OAAA,GAAU,UAAU,IAAK,EAAA;AAC/B,IAAI,IAAA,OAAA,CAAQ,MAAa,OAAA,CAAA;AAEzB,IAAA,MAAM,IAAI,OAAQ,CAAA,KAAA;AAClB,IAAA,MAAM,UAAa,GAAAC,oCAAA,CAAqC,CAAG,EAAA,CAAA,EAAG,UAAU,CAAA;AACxE,IAAI,IAAA,CAACC,4BAAgB,CAAA,UAAU,CAAG,EAAA;AACjC,MAAO,OAAAC,2BAAA,CAAe,UAAU,CAAA,GAAI,EAAK,GAAA,CAAA;AAAA;AAC1C;AAGD,EAAA,OAAO,SAAU,CAAA,IAAA,EAAO,CAAA,IAAA,GAAO,CAAI,GAAA,EAAA;AACpC;AAnBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"compareBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { compareIteratorElements, orderingIsEqual, orderingIsLess, type CompareByComparator, type LexicographicComparison } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * {@link LexicographicComparison Lexicographically} compares the elements of both iterators are equal. That is:\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { ascNumber, compareBy } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(compareBy(x, y, (x, y) => ascNumber(x, y)));\n * // Output: -1\n * console.log(compareBy(x, y, (x, y) => ascNumber(x * x, y)));\n * // Output: 0\n * console.log(compareBy(x, y, (x, y) => ascNumber(x * 2, y)));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function compareBy<const ElementType>(\n\titerable: IterableResolvable<ElementType | undefined>,\n\tother: IterableResolvable<ElementType | undefined>,\n\tcomparator: CompareByComparator<ElementType>\n): LexicographicComparison {\n\tconst iterator1 = from(other);\n\n\tfor (const x of toIterableIterator(iterable)) {\n\t\tconst result1 = iterator1.next();\n\t\tif (result1.done) return 1;\n\n\t\tconst y = result1.value;\n\t\tconst comparison = compareIteratorElements<ElementType>(x, y, comparator);\n\t\tif (!orderingIsEqual(comparison)) {\n\t\t\treturn orderingIsLess(comparison) ? -1 : 1;\n\t\t}\n\t}\n\n\treturn iterator1.next().done ? 0 : -1;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/compareBy.ts"],"names":["from","toIterableIterator","compareIteratorElements","orderingIsEqual","orderingIsLess"],"mappings":";;;;;;;;AA6BO,SAAS,SAAA,CACf,QAAA,EACA,KAAA,EACA,UAAA,EAC0B;AAC1B,EAAA,MAAM,SAAA,GAAYA,cAAK,KAAK,CAAA;AAE5B,EAAA,KAAA,MAAW,CAAA,IAAKC,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AAC7C,IAAA,MAAM,OAAA,GAAU,UAAU,IAAA,EAAK;AAC/B,IAAA,IAAI,OAAA,CAAQ,MAAM,OAAO,CAAA;AAEzB,IAAA,MAAM,IAAI,OAAA,CAAQ,KAAA;AAClB,IAAA,MAAM,UAAA,GAAaC,oCAAA,CAAqC,CAAA,EAAG,CAAA,EAAG,UAAU,CAAA;AACxE,IAAA,IAAI,CAACC,4BAAA,CAAgB,UAAU,CAAA,EAAG;AACjC,MAAA,OAAOC,2BAAA,CAAe,UAAU,CAAA,GAAI,EAAA,GAAK,CAAA;AAAA,IAC1C;AAAA,EACD;AAEA,EAAA,OAAO,SAAA,CAAU,IAAA,EAAK,CAAE,IAAA,GAAO,CAAA,GAAI,EAAA;AACpC;AAnBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"compareBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { compareIteratorElements, orderingIsEqual, orderingIsLess, type CompareByComparator, type LexicographicComparison } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * {@link LexicographicComparison Lexicographically} compares the elements of both iterators are equal. That is:\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { ascNumber, compareBy } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(compareBy(x, y, (x, y) => ascNumber(x, y)));\n * // Output: -1\n * console.log(compareBy(x, y, (x, y) => ascNumber(x * x, y)));\n * // Output: 0\n * console.log(compareBy(x, y, (x, y) => ascNumber(x * 2, y)));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function compareBy<const ElementType>(\n\titerable: IterableResolvable<ElementType | undefined>,\n\tother: IterableResolvable<ElementType | undefined>,\n\tcomparator: CompareByComparator<ElementType>\n): LexicographicComparison {\n\tconst iterator1 = from(other);\n\n\tfor (const x of toIterableIterator(iterable)) {\n\t\tconst result1 = iterator1.next();\n\t\tif (result1.done) return 1;\n\n\t\tconst y = result1.value;\n\t\tconst comparison = compareIteratorElements<ElementType>(x, y, comparator);\n\t\tif (!orderingIsEqual(comparison)) {\n\t\t\treturn orderingIsLess(comparison) ? -1 : 1;\n\t\t}\n\t}\n\n\treturn iterator1.next().done ? 0 : -1;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/compress.ts"],"names":["from","toIterableIterator"],"mappings":";;;;;;;AAwBO,UAAU,QAAA,CAChB,UACA,SACgC,EAAA;AAChC,EAAM,MAAA,iBAAA,GAAoBA,cAAK,SAAS,CAAA;AACxC,EAAW,KAAA,MAAA,sBAAA,IAA0BC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AAClE,IAAM,MAAA,cAAA,GAAiB,kBAAkB,IAAK,EAAA;AAC9C,IAAA,IAAI,eAAe,IAAM,EAAA;AACxB,MAAA;AAAA;AAGD,IAAA,IAAI,eAAe,KAAO,EAAA;AACzB,MAAM,MAAA,sBAAA;AAAA;AACP;AAEF;AAfiB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"compress.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable of the first iterable based on the truthiness of the corresponding element in the second iterable.\n *\n * @param iterable An iterator that contains elements to be compressed.\n * @param selectors The selectors that determine which elements to include in the result.\n * @returns An iterator that contains only the elements from the input iterator that correspond to `true` values in the\n * selectors iterator.\n *\n * @example\n * ```typescript\n * import { compress } from '@sapphire/iterator-utilities';\n *\n * const iterable = compress([1, 2, 3, 4, 5], [true, false, true, false, true]);\n * console.log([...iterable]);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes both input iterators until either is exhausted.\n */\nexport function* compress<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tselectors: IterableResolvable<boolean>\n): IterableIterator<ElementType> {\n\tconst resolvedSelectors = from(selectors);\n\tfor (const resolvedIterableResult of toIterableIterator(iterable)) {\n\t\tconst selectorResult = resolvedSelectors.next();\n\t\tif (selectorResult.done) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (selectorResult.value) {\n\t\t\tyield resolvedIterableResult;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/compress.ts"],"names":["from","toIterableIterator"],"mappings":";;;;;;;AAwBO,UAAU,QAAA,CAChB,UACA,SAAA,EACgC;AAChC,EAAA,MAAM,iBAAA,GAAoBA,cAAK,SAAS,CAAA;AACxC,EAAA,KAAA,MAAW,sBAAA,IAA0BC,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AAClE,IAAA,MAAM,cAAA,GAAiB,kBAAkB,IAAA,EAAK;AAC9C,IAAA,IAAI,eAAe,IAAA,EAAM;AACxB,MAAA;AAAA,IACD;AAEA,IAAA,IAAI,eAAe,KAAA,EAAO;AACzB,MAAA,MAAM,sBAAA;AAAA,IACP;AAAA,EACD;AACD;AAfiB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"compress.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable of the first iterable based on the truthiness of the corresponding element in the second iterable.\n *\n * @param iterable An iterator that contains elements to be compressed.\n * @param selectors The selectors that determine which elements to include in the result.\n * @returns An iterator that contains only the elements from the input iterator that correspond to `true` values in the\n * selectors iterator.\n *\n * @example\n * ```typescript\n * import { compress } from '@sapphire/iterator-utilities';\n *\n * const iterable = compress([1, 2, 3, 4, 5], [true, false, true, false, true]);\n * console.log([...iterable]);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes both input iterators until either is exhausted.\n */\nexport function* compress<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tselectors: IterableResolvable<boolean>\n): IterableIterator<ElementType> {\n\tconst resolvedSelectors = from(selectors);\n\tfor (const resolvedIterableResult of toIterableIterator(iterable)) {\n\t\tconst selectorResult = resolvedSelectors.next();\n\t\tif (selectorResult.done) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (selectorResult.value) {\n\t\t\tyield resolvedIterableResult;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/contains.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAuBO,SAAS,QAAA,CAA4B,UAA2C,KAA6B,EAAA;AACnH,EAAW,KAAA,MAAA,OAAA,IAAWA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAI,IAAA,OAAA,KAAY,OAAc,OAAA,IAAA;AAAA;AAG/B,EAAO,OAAA,KAAA;AACR;AANgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"contains.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable The iterator in which to locate a value.\n * @param value The value to locate in the iterator.\n * @returns `true` if the value is found in the iterator; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { contains } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(contains(iterable, 3));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function contains<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): boolean {\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) return true;\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/contains.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAuBO,SAAS,QAAA,CAA4B,UAA2C,KAAA,EAA6B;AACnH,EAAA,KAAA,MAAW,OAAA,IAAWA,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACnD,IAAA,IAAI,OAAA,KAAY,OAAO,OAAO,IAAA;AAAA,EAC/B;AAEA,EAAA,OAAO,KAAA;AACR;AANgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"contains.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable The iterator in which to locate a value.\n * @param value The value to locate in the iterator.\n * @returns `true` if the value is found in the iterator; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { contains } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(contains(iterable, 3));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function contains<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): boolean {\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) return true;\n\t}\n\n\treturn false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/count.ts"],"names":["count","from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAmD,EAAA;AAC3F,EAAA,IAAIA,MAAQ,GAAA,CAAA;AACZ,EAAM,MAAA,gBAAA,GAAmBC,cAAK,QAAQ,CAAA;AACtC,EAAA,OAAO,CAAC,gBAAA,CAAiB,IAAK,EAAA,CAAE,IAAM,EAAA;AACrC,IAAAD,MAAAA,EAAAA;AAAA;AAGD,EAAOA,OAAAA,MAAAA;AACR;AARgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"count.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the iterable and returns the number of elements.\n *\n * @param iterable An iterator that contains elements to be counted.\n * @returns The number of elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { count } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(count(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function count<const ElementType>(iterable: IterableResolvable<ElementType>): number {\n\tlet count = 0;\n\tconst resolvedIterable = from(iterable);\n\twhile (!resolvedIterable.next().done) {\n\t\tcount++;\n\t}\n\n\treturn count;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/count.ts"],"names":["count","from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAA,EAAmD;AAC3F,EAAA,IAAIA,MAAAA,GAAQ,CAAA;AACZ,EAAA,MAAM,gBAAA,GAAmBC,cAAK,QAAQ,CAAA;AACtC,EAAA,OAAO,CAAC,gBAAA,CAAiB,IAAA,EAAK,CAAE,IAAA,EAAM;AACrC,IAAAD,MAAAA,EAAAA;AAAA,EACD;AAEA,EAAA,OAAOA,MAAAA;AACR;AARgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"count.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the iterable and returns the number of elements.\n *\n * @param iterable An iterator that contains elements to be counted.\n * @returns The number of elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { count } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(count(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function count<const ElementType>(iterable: IterableResolvable<ElementType>): number {\n\tlet count = 0;\n\tconst resolvedIterable = from(iterable);\n\twhile (!resolvedIterable.next().done) {\n\t\tcount++;\n\t}\n\n\treturn count;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/cycle.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAmBO,UAAU,MAAyB,QAA0E,EAAA;AACnH,EAAA,MAAM,UAAU,EAAC;AACjB,EAAW,KAAA,MAAA,OAAA,IAAWA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAM,MAAA,OAAA;AACN,IAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AAAA;AAGrB,EAAO,OAAA,OAAA,CAAQ,SAAS,CAAG,EAAA;AAC1B,IAAA,KAAA,MAAW,WAAW,OAAS,EAAA;AAC9B,MAAM,MAAA,OAAA;AAAA;AACP;AAEF;AAZiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"cycle.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an infinite iterable by cycling through the elements of the input iterable.\n *\n * @param iterable An iterator to cycle over.\n *\n * @example\n * ```typescript\n * import { cycle } from '@sapphire/iterator-utilities';\n *\n * const iterable = cycle([1, 2, 3]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 1, 2, 3, 1, 2, 3, ...\n * }\n * ```\n */\nexport function* cycle<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst results = [] as ElementType[];\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield element;\n\t\tresults.push(element);\n\t}\n\n\twhile (results.length > 0) {\n\t\tfor (const element of results) {\n\t\t\tyield element;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/cycle.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAmBO,UAAU,MAAyB,QAAA,EAA0E;AACnH,EAAA,MAAM,UAAU,EAAC;AACjB,EAAA,KAAA,MAAW,OAAA,IAAWA,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACnD,IAAA,MAAM,OAAA;AACN,IAAA,OAAA,CAAQ,KAAK,OAAO,CAAA;AAAA,EACrB;AAEA,EAAA,OAAO,OAAA,CAAQ,SAAS,CAAA,EAAG;AAC1B,IAAA,KAAA,MAAW,WAAW,OAAA,EAAS;AAC9B,MAAA,MAAM,OAAA;AAAA,IACP;AAAA,EACD;AACD;AAZiB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"cycle.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an infinite iterable by cycling through the elements of the input iterable.\n *\n * @param iterable An iterator to cycle over.\n *\n * @example\n * ```typescript\n * import { cycle } from '@sapphire/iterator-utilities';\n *\n * const iterable = cycle([1, 2, 3]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 1, 2, 3, 1, 2, 3, ...\n * }\n * ```\n */\nexport function* cycle<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst results = [] as ElementType[];\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield element;\n\t\tresults.push(element);\n\t}\n\n\twhile (results.length > 0) {\n\t\tfor (const element of results) {\n\t\t\tyield element;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/difference.ts"],"names":["toIterableIterator","filter"],"mappings":";;;;;;;AAwBO,SAAS,UAAA,CACf,OACA,MACgC,EAAA;AAChC,EAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAAA,yCAAA,CAAmB,MAAM,CAAC,CAAA;AAC9C,EAAO,OAAAC,iBAAA,CAAO,OAAO,CAAC,KAAA,KAAU,CAAC,GAAI,CAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAChD;AANgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"difference.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements of the first iterable that are not in the second iterable.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to exclude from the result.\n *\n * @example\n * ```typescript\n * import { difference } from '@sapphire/iterator-utilities';\n *\n * const first = [1, 2, 3, 4, 5];\n * const second = [3, 4, 5, 6, 7];\n * console.log([...difference(first, second)]);\n * // Output: [1, 2]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to exclude from `first`.\n */\nexport function difference<const ElementType>(\n\tfirst: IterableResolvable<ElementType>,\n\tsecond: IterableResolvable<ElementType>\n): IterableIterator<ElementType> {\n\tconst set = new Set(toIterableIterator(second));\n\treturn filter(first, (value) => !set.has(value));\n}\n\nexport { difference as except, difference as omit };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/difference.ts"],"names":["toIterableIterator","filter"],"mappings":";;;;;;;AAwBO,SAAS,UAAA,CACf,OACA,MAAA,EACgC;AAChC,EAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAIA,yCAAA,CAAmB,MAAM,CAAC,CAAA;AAC9C,EAAA,OAAOC,iBAAA,CAAO,OAAO,CAAC,KAAA,KAAU,CAAC,GAAA,CAAI,GAAA,CAAI,KAAK,CAAC,CAAA;AAChD;AANgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"difference.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements of the first iterable that are not in the second iterable.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to exclude from the result.\n *\n * @example\n * ```typescript\n * import { difference } from '@sapphire/iterator-utilities';\n *\n * const first = [1, 2, 3, 4, 5];\n * const second = [3, 4, 5, 6, 7];\n * console.log([...difference(first, second)]);\n * // Output: [1, 2]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to exclude from `first`.\n */\nexport function difference<const ElementType>(\n\tfirst: IterableResolvable<ElementType>,\n\tsecond: IterableResolvable<ElementType>\n): IterableIterator<ElementType> {\n\tconst set = new Set(toIterableIterator(second));\n\treturn filter(first, (value) => !set.has(value));\n}\n\nexport { difference as except, difference as omit };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/drop.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toIterableIterator","empty"],"mappings":";;;;;;;;;AAsBO,SAAS,IAAA,CAAwB,UAA2C,KAA8C,EAAA;AAChI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAM,MAAA,gBAAA,GAAmBC,0CAAmB,QAAQ,CAAA;AAGpD,EAAI,IAAA,KAAA,KAAU,GAAU,OAAA,gBAAA;AAExB,EAAA,IAAI,KAAU,KAAA,MAAA,CAAO,iBAAmB,EAAA,OAAOC,eAAM,EAAA;AAErD,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,KAAA,EAAO,CAAK,EAAA,EAAA;AAC/B,IAAI,IAAA,gBAAA,CAAiB,IAAK,EAAA,CAAE,IAAM,EAAA;AAAA;AAGnC,EAAO,OAAA,gBAAA;AACR;AAdgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"drop.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable by `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of elements to drop from the start of the iteration.\n * @returns An iterator that contains the elements of the provided iterator, except for the first `count` elements.\n *\n * @example\n * ```typescript\n * import { drop } from '@sapphire/iterator-utilities';\n *\n * const iterable = drop(iterator, 2);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n */\nexport function drop<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst resolvedIterable = toIterableIterator(iterable);\n\n\t// If the count is 0, return the original iterable:\n\tif (count === 0) return resolvedIterable;\n\t// If the count is infinite, return an empty iterable:\n\tif (count === Number.POSITIVE_INFINITY) return empty();\n\n\tfor (let i = 0; i < count; i++) {\n\t\tif (resolvedIterable.next().done) break;\n\t}\n\n\treturn resolvedIterable;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/drop.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toIterableIterator","empty"],"mappings":";;;;;;;;;AAsBO,SAAS,IAAA,CAAwB,UAA2C,KAAA,EAA8C;AAChI,EAAA,KAAA,GAAQA,wCAAA,CAAkBC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAA,MAAM,gBAAA,GAAmBC,0CAAmB,QAAQ,CAAA;AAGpD,EAAA,IAAI,KAAA,KAAU,GAAG,OAAO,gBAAA;AAExB,EAAA,IAAI,KAAA,KAAU,MAAA,CAAO,iBAAA,EAAmB,OAAOC,eAAA,EAAM;AAErD,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,KAAA,EAAO,CAAA,EAAA,EAAK;AAC/B,IAAA,IAAI,gBAAA,CAAiB,IAAA,EAAK,CAAE,IAAA,EAAM;AAAA,EACnC;AAEA,EAAA,OAAO,gBAAA;AACR;AAdgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"drop.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable by `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of elements to drop from the start of the iteration.\n * @returns An iterator that contains the elements of the provided iterator, except for the first `count` elements.\n *\n * @example\n * ```typescript\n * import { drop } from '@sapphire/iterator-utilities';\n *\n * const iterable = drop(iterator, 2);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n */\nexport function drop<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst resolvedIterable = toIterableIterator(iterable);\n\n\t// If the count is 0, return the original iterable:\n\tif (count === 0) return resolvedIterable;\n\t// If the count is infinite, return an empty iterable:\n\tif (count === Number.POSITIVE_INFINITY) return empty();\n\n\tfor (let i = 0; i < count; i++) {\n\t\tif (resolvedIterable.next().done) break;\n\t}\n\n\treturn resolvedIterable;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dropLast.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toArray","empty","take"],"mappings":";;;;;;;;;;AA2BO,SAAS,QAAA,CAA4B,UAA2C,KAA8C,EAAA;AACpI,EAAA,KAAA,GAAQA,wCAAkB,CAAAC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAM,MAAA,KAAA,GAAQC,oBAAQ,QAAQ,CAAA;AAC9B,EAAA,IAAI,KAAM,CAAA,MAAA,IAAU,KAAO,EAAA,OAAOC,eAAM,EAAA;AACxC,EAAA,OAAOC,cAAK,KAAM,CAAA,MAAA,EAAU,EAAA,KAAA,CAAM,SAAS,KAAK,CAAA;AACjD;AALgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"dropLast.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable, creating a new iterator without the last `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of values to drop from the end of the iterator.\n * @returns An iterator that contains the elements of the provided iterator, except for the last `count` elements.\n *\n * @example\n * ```typescript\n * import { dropLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropLast([1, 2, 3, 4, 5], 2);\n * console.log([...iterable]);\n * // Output: [1, 2, 3]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function dropLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst array = toArray(iterable);\n\tif (array.length <= count) return empty();\n\treturn take(array.values(), array.length - count);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/dropLast.ts"],"names":["assertNotNegative","toIntegerOrInfinityOrThrow","toArray","empty","take"],"mappings":";;;;;;;;;;AA2BO,SAAS,QAAA,CAA4B,UAA2C,KAAA,EAA8C;AACpI,EAAA,KAAA,GAAQA,wCAAA,CAAkBC,0DAAA,CAA2B,KAAK,CAAA,EAAG,KAAK,CAAA;AAClE,EAAA,MAAM,KAAA,GAAQC,oBAAQ,QAAQ,CAAA;AAC9B,EAAA,IAAI,KAAA,CAAM,MAAA,IAAU,KAAA,EAAO,OAAOC,eAAA,EAAM;AACxC,EAAA,OAAOC,cAAK,KAAA,CAAM,MAAA,EAAO,EAAG,KAAA,CAAM,SAAS,KAAK,CAAA;AACjD;AALgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"dropLast.cjs","sourcesContent":["import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable, creating a new iterator without the last `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of values to drop from the end of the iterator.\n * @returns An iterator that contains the elements of the provided iterator, except for the last `count` elements.\n *\n * @example\n * ```typescript\n * import { dropLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropLast([1, 2, 3, 4, 5], 2);\n * console.log([...iterable]);\n * // Output: [1, 2, 3]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function dropLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst array = toArray(iterable);\n\tif (array.length <= count) return empty();\n\treturn take(array.values(), array.length - count);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/dropWhile.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA8BO,UAAU,SAAA,CAChB,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,CAAC,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,CAAG,EAAA;AAChC,MAAM,MAAA,KAAA;AAAA;AACP;AAEF;AAZiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"dropWhile.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterator without the elements that satisfy the specified test.\n *\n * @param iterable An iterator to drop values from.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a falsy value to make the element yielded by the iterator helper, and a truthy value otherwise.\n * @returns An iterator that produces elements from the given iterator that don't satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { dropWhile } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropWhile([1, 2, 3, 4, 5], (value) => value < 3);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @seealso {@link filter} or {@link takeWhile} for the opposite behavior.\n */\nexport function dropWhile<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<Exclude<ElementType, FilteredType>>;\nexport function dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) {\n\t\t\tyield value;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/dropWhile.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA8BO,UAAU,SAAA,CAChB,UACA,UAAA,EACgC;AAChC,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,CAAC,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,CAAA,EAAG;AAChC,MAAA,MAAM,KAAA;AAAA,IACP;AAAA,EACD;AACD;AAZiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"dropWhile.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterator without the elements that satisfy the specified test.\n *\n * @param iterable An iterator to drop values from.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a falsy value to make the element yielded by the iterator helper, and a truthy value otherwise.\n * @returns An iterator that produces elements from the given iterator that don't satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { dropWhile } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropWhile([1, 2, 3, 4, 5], (value) => value < 3);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @seealso {@link filter} or {@link takeWhile} for the opposite behavior.\n */\nexport function dropWhile<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<Exclude<ElementType, FilteredType>>;\nexport function dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) {\n\t\t\tyield value;\n\t\t}\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/empty.ts"],"names":["makeIterableIterator"],"mappings":";;;;;;AAgBO,SAAS,KAAkE,GAAA;AACjF,EAAA,OAAOA,+CAAkC,OAAO,EAAE,MAAM,IAAM,EAAA,KAAA,EAAO,QAAY,CAAA,CAAA;AAClF;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"empty.cjs","sourcesContent":["import { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an empty iterator.\n *\n * @returns An empty iterator.\n *\n * @example\n * ```typescript\n * import { empty } from '@sapphire/iterator-utilities';\n *\n * const iterable = empty();\n * console.log([...iterable]);\n * // Output: []\n * ```\n */\nexport function empty<const ElementType = never>(): IterableIterator<ElementType> {\n\treturn makeIterableIterator<ElementType>(() => ({ done: true, value: undefined }));\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/empty.ts"],"names":["makeIterableIterator"],"mappings":";;;;;;AAgBO,SAAS,KAAA,GAAkE;AACjF,EAAA,OAAOA,+CAAkC,OAAO,EAAE,MAAM,IAAA,EAAM,KAAA,EAAO,QAAU,CAAE,CAAA;AAClF;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"empty.cjs","sourcesContent":["import { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an empty iterator.\n *\n * @returns An empty iterator.\n *\n * @example\n * ```typescript\n * import { empty } from '@sapphire/iterator-utilities';\n *\n * const iterable = empty();\n * console.log([...iterable]);\n * // Output: []\n * ```\n */\nexport function empty<const ElementType = never>(): IterableIterator<ElementType> {\n\treturn makeIterableIterator<ElementType>(() => ({ done: true, value: undefined }));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/enumerate.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAsBO,UAAU,UAA6B,QAAoF,EAAA;AACjI,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAM,MAAA,CAAC,SAAS,KAAK,CAAA;AAAA;AAEvB;AALiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"enumerate.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable that yields the index and value of each element.\n *\n * @param iterable An iterator to enumerate.\n * @returns An iterator that yields the index and value of each element in the source iterator.\n *\n * @example\n * ```typescript\n * import { enumerate } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['a', 'b', 'c'];\n * for (const [index, value] of enumerate(iterable)) {\n * \tconsole.log(`Index: ${index}, Value: ${value}`);\n * \t// Output: Index: 0, Value: a\n * \t// Output: Index: 1, Value: b\n * \t// Output: Index: 2, Value: c\n * }\n * ```\n */\nexport function* enumerate<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<[number, ElementType]> {\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield [index++, value];\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/enumerate.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAsBO,UAAU,UAA6B,QAAA,EAAoF;AACjI,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,KAAA,IAASA,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,IAAA,MAAM,CAAC,SAAS,KAAK,CAAA;AAAA,EACtB;AACD;AALiB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"enumerate.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterable that yields the index and value of each element.\n *\n * @param iterable An iterator to enumerate.\n * @returns An iterator that yields the index and value of each element in the source iterator.\n *\n * @example\n * ```typescript\n * import { enumerate } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['a', 'b', 'c'];\n * for (const [index, value] of enumerate(iterable)) {\n * \tconsole.log(`Index: ${index}, Value: ${value}`);\n * \t// Output: Index: 0, Value: a\n * \t// Output: Index: 1, Value: b\n * \t// Output: Index: 2, Value: c\n * }\n * ```\n */\nexport function* enumerate<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<[number, ElementType]> {\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield [index++, value];\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/equal.ts"],"names":["equalBy"],"mappings":";;;;;;AAwBO,SAAS,KAAA,CAAyB,UAA2C,KAAiD,EAAA;AACpI,EAAA,OAAOA,oBAAQ,QAAU,EAAA,KAAA,EAAO,CAAC,CAAG,EAAA,CAAA,KAAM,MAAM,CAAC,CAAA;AAClD;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"equal.cjs","sourcesContent":["import { equalBy } from './equalBy';\nimport type { IterableResolvable } from './from';\n\n/**\n * Determines if the elements of both iterators are equal.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { equal } from '@sapphire/iterator-utilities';\n *\n * console.log(equal([1], [1]));\n * // Output: true\n * console.log(equal([1], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function equal<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\treturn equalBy(iterable, other, (a, b) => a === b);\n}\n\nexport { equal as eq };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/equal.ts"],"names":["equalBy"],"mappings":";;;;;;AAwBO,SAAS,KAAA,CAAyB,UAA2C,KAAA,EAAiD;AACpI,EAAA,OAAOA,oBAAQ,QAAA,EAAU,KAAA,EAAO,CAAC,CAAA,EAAG,CAAA,KAAM,MAAM,CAAC,CAAA;AAClD;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"equal.cjs","sourcesContent":["import { equalBy } from './equalBy';\nimport type { IterableResolvable } from './from';\n\n/**\n * Determines if the elements of both iterators are equal.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal.\n *\n * @example\n * ```typescript\n * import { equal } from '@sapphire/iterator-utilities';\n *\n * console.log(equal([1], [1]));\n * // Output: true\n * console.log(equal([1], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function equal<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\treturn equalBy(iterable, other, (a, b) => a === b);\n}\n\nexport { equal as eq };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/equalBy.ts"],"names":["assertFunction","from","toIterableIterator"],"mappings":";;;;;;;;AA0BO,SAAS,OAAA,CACf,QACA,EAAA,KAAA,EACA,UACU,EAAA;AACV,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,SAAA,GAAYC,cAAK,KAAK,CAAA;AAE5B,EAAW,KAAA,MAAA,MAAA,IAAUC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AAClD,IAAM,MAAA,OAAA,GAAU,UAAU,IAAK,EAAA;AAC/B,IAAI,IAAA,OAAA,CAAQ,QAAQ,CAAC,UAAA,CAAW,QAAQ,OAAQ,CAAA,KAAK,GAAU,OAAA,KAAA;AAAA;AAGhE,EAAO,OAAA,SAAA,CAAU,IAAK,EAAA,CAAE,IAAS,KAAA,IAAA;AAClC;AAfgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"equalBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Determines if the elements of both iterators are equal with respect to the specified equality function.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal with respect to the specified equality function.\n *\n * @example\n * ```typescript\n * import { equalBy } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n *\n * console.log(equalBy(x, y, (a, b) => a * a === b));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function equalBy<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tother: IterableResolvable<ElementType>,\n\tcallbackFn: (x: ElementType, y: ElementType) => boolean\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator1 = from(other);\n\n\tfor (const value0 of toIterableIterator(iterable)) {\n\t\tconst result1 = iterator1.next();\n\t\tif (result1.done || !callbackFn(value0, result1.value)) return false;\n\t}\n\n\treturn iterator1.next().done === true;\n}\n\nexport { equalBy as eqBy };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/equalBy.ts"],"names":["assertFunction","from","toIterableIterator"],"mappings":";;;;;;;;AA0BO,SAAS,OAAA,CACf,QAAA,EACA,KAAA,EACA,UAAA,EACU;AACV,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,SAAA,GAAYC,cAAK,KAAK,CAAA;AAE5B,EAAA,KAAA,MAAW,MAAA,IAAUC,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AAClD,IAAA,MAAM,OAAA,GAAU,UAAU,IAAA,EAAK;AAC/B,IAAA,IAAI,OAAA,CAAQ,QAAQ,CAAC,UAAA,CAAW,QAAQ,OAAA,CAAQ,KAAK,GAAG,OAAO,KAAA;AAAA,EAChE;AAEA,EAAA,OAAO,SAAA,CAAU,IAAA,EAAK,CAAE,IAAA,KAAS,IAAA;AAClC;AAfgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"equalBy.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Determines if the elements of both iterators are equal with respect to the specified equality function.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n * @returns Whether the two iterators are equal with respect to the specified equality function.\n *\n * @example\n * ```typescript\n * import { equalBy } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n *\n * console.log(equalBy(x, y, (a, b) => a * a === b));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function equalBy<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tother: IterableResolvable<ElementType>,\n\tcallbackFn: (x: ElementType, y: ElementType) => boolean\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator1 = from(other);\n\n\tfor (const value0 of toIterableIterator(iterable)) {\n\t\tconst result1 = iterator1.next();\n\t\tif (result1.done || !callbackFn(value0, result1.value)) return false;\n\t}\n\n\treturn iterator1.next().done === true;\n}\n\nexport { equalBy as eqBy };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/every.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAmCO,SAAS,KAAA,CAAyB,UAA2C,UAA8D,EAAA;AACjJ,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,CAAC,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,GAAU,OAAA,KAAA;AAAA;AAGzC,EAAO,OAAA,IAAA;AACR;AATgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"every.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Tests whether all elements in the iterable pass the test implemented by the provided function.\n *\n * @param iterable The iterator to check.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if callbackFn returns a truthy value for every element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { every } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(every(iterable, (value) => value < 10));\n * // Output: true\n *\n * console.log(every(iterable, (value) => value < 3));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function every<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): iterable is IterableIterator<FilteredType>;\nexport function every<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean;\nexport function every<const ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => boolean) {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) return false;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/every.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAmCO,SAAS,KAAA,CAAyB,UAA2C,UAAA,EAA8D;AACjJ,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,CAAC,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,GAAG,OAAO,KAAA;AAAA,EACzC;AAEA,EAAA,OAAO,IAAA;AACR;AATgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"every.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Tests whether all elements in the iterable pass the test implemented by the provided function.\n *\n * @param iterable The iterator to check.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if callbackFn returns a truthy value for every element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { every } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(every(iterable, (value) => value < 10));\n * // Output: true\n *\n * console.log(every(iterable, (value) => value < 3));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function every<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): iterable is IterableIterator<FilteredType>;\nexport function every<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean;\nexport function every<const ElementType>(iterable: IterableResolvable<ElementType>, callbackFn: (element: ElementType, index: number) => boolean) {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) return false;\n\t}\n\n\treturn true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/filter.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA4BO,UAAU,MAAA,CAChB,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,IAAI,UAAW,CAAA,KAAA,EAAO,KAAO,EAAA,CAAA,EAAS,MAAA,KAAA;AAAA;AAExC;AAViB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"filter.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that pass the test implemented by the provided function.\n *\n * @param iterable The iterator to filter.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to make the element yielded by the iterator helper, and a falsy value otherwise.\n * @returns An iterator that produces elements from the given iterator that satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { filter } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...filter(iterable, (value) => value % 2 === 0)]);\n * // Output: [2, 4]\n * ```\n */\nexport function filter<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<FilteredType>;\nexport function filter<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* filter<ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) yield value;\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/filter.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AA4BO,UAAU,MAAA,CAChB,UACA,UAAA,EACgC;AAChC,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,MAAM,KAAA;AAAA,EACvC;AACD;AAViB,MAAA,CAAA,MAAA,EAAA,QAAA,CAAA","file":"filter.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that pass the test implemented by the provided function.\n *\n * @param iterable The iterator to filter.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to make the element yielded by the iterator helper, and a falsy value otherwise.\n * @returns An iterator that produces elements from the given iterator that satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { filter } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...filter(iterable, (value) => value % 2 === 0)]);\n * // Output: [2, 4]\n * ```\n */\nexport function filter<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<FilteredType>;\nexport function filter<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* filter<ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) yield value;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/find.ts"],"names":["first","filter"],"mappings":";;;;;;;AAgCO,SAAS,IAAA,CACf,UACA,UAC0B,EAAA;AAC1B,EAAA,OAAOA,eAAM,CAAAC,iBAAA,CAAO,QAAU,EAAA,UAAU,CAAC,CAAA;AAC1C;AALgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"find.cjs","sourcesContent":["import { filter } from './filter';\nimport { first } from './first';\nimport type { IterableResolvable } from './from';\n\n/**\n * Advances the iterable until it finds the element, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function that determines if a value is the one being searched for.\n * @returns\n *\n * @example\n * ```typescript\n * import { find } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(find(iterable, (value) => value % 2 === 0));\n * // Output: 2\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function find<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): FilteredType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined {\n\treturn first(filter(iterable, callbackFn));\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/find.ts"],"names":["first","filter"],"mappings":";;;;;;;AAgCO,SAAS,IAAA,CACf,UACA,UAAA,EAC0B;AAC1B,EAAA,OAAOA,eAAA,CAAMC,iBAAA,CAAO,QAAA,EAAU,UAAU,CAAC,CAAA;AAC1C;AALgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"find.cjs","sourcesContent":["import { filter } from './filter';\nimport { first } from './first';\nimport type { IterableResolvable } from './from';\n\n/**\n * Advances the iterable until it finds the element, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function that determines if a value is the one being searched for.\n * @returns\n *\n * @example\n * ```typescript\n * import { find } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(find(iterable, (value) => value % 2 === 0));\n * // Output: 2\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function find<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): FilteredType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined;\nexport function find<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): ElementType | undefined {\n\treturn first(filter(iterable, callbackFn));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/findIndex.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAwBO,SAAS,SAAA,CACf,UACA,UACS,EAAA;AACT,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAI,IAAA,UAAA,CAAW,OAAS,EAAA,KAAK,CAAG,EAAA;AAC/B,MAAO,OAAA,KAAA;AAAA;AAGR,IAAA,KAAA,EAAA;AAAA;AAGD,EAAO,OAAA,EAAA;AACR;AAhBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"findIndex.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning its index if it's found and `-1` otherwise.\n *\n * @param iterable An iterator to search for an element in.\n * @param callbackFn A function that determines if an element is the one being searched for.\n * @returns The index of the first element that satisfies the predicate, or `-1` if no elements satisfy the predicate.\n *\n * @example\n * ```typescript\n * import { findIndex } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(findIndex(iterable, (value) => value % 2 === 0));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function findIndex<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): number {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (callbackFn(element, index)) {\n\t\t\treturn index;\n\t\t}\n\n\t\tindex++;\n\t}\n\n\treturn -1;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/findIndex.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAwBO,SAAS,SAAA,CACf,UACA,UAAA,EACS;AACT,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,IAAI,UAAA,CAAW,OAAA,EAAS,KAAK,CAAA,EAAG;AAC/B,MAAA,OAAO,KAAA;AAAA,IACR;AAEA,IAAA,KAAA,EAAA;AAAA,EACD;AAEA,EAAA,OAAO,EAAA;AACR;AAhBgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"findIndex.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning its index if it's found and `-1` otherwise.\n *\n * @param iterable An iterator to search for an element in.\n * @param callbackFn A function that determines if an element is the one being searched for.\n * @returns The index of the first element that satisfies the predicate, or `-1` if no elements satisfy the predicate.\n *\n * @example\n * ```typescript\n * import { findIndex } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(findIndex(iterable, (value) => value % 2 === 0));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function findIndex<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): number {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (callbackFn(element, index)) {\n\t\t\treturn index;\n\t\t}\n\n\t\tindex++;\n\t}\n\n\treturn -1;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/first.ts"],"names":["from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAoE,EAAA;AAC5G,EAAA,OAAOA,aAAK,CAAA,QAAQ,CAAE,CAAA,IAAA,EAAO,CAAA,KAAA;AAC9B;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"first.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the first element of the iterable, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable The iterator to return the first value of.\n * @returns The first value of the iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { first } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(first(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function first<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\treturn from(iterable).next().value;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/first.ts"],"names":["from"],"mappings":";;;;;;AAqBO,SAAS,MAAyB,QAAA,EAAoE;AAC5G,EAAA,OAAOA,aAAA,CAAK,QAAQ,CAAA,CAAE,IAAA,EAAK,CAAE,KAAA;AAC9B;AAFgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA","file":"first.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Consumes the first element of the iterable, returning it if it's found and `undefined` otherwise.\n *\n * @param iterable The iterator to return the first value of.\n * @returns The first value of the iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { first } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(first(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function first<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\treturn from(iterable).next().value;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/flat.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkBO,UAAU,KAAwB,SAA+F,EAAA;AACvI,EAAW,KAAA,MAAA,KAAA,IAASA,yCAAmB,CAAA,SAAS,CAAG,EAAA;AAClD,IAAA,OAAOA,0CAAmB,KAAK,CAAA;AAAA;AAEjC;AAJiB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"flat.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable in the input iterable.\n *\n * @param iterables An iterator to map.\n * @returns An iterator that yields the entries of each iterator.\n *\n * @example\n * ```typescript\n * import { flat } from '@sapphire/iterator-utilities';\n *\n * const iterable = flat([[1, 2], [3, 4], [5, 6]]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6]\n * ```\n */\nexport function* flat<const ElementType>(iterables: IterableResolvable<IterableResolvable<ElementType>>): IterableIterator<ElementType> {\n\tfor (const value of toIterableIterator(iterables)) {\n\t\tyield* toIterableIterator(value);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/flat.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAkBO,UAAU,KAAwB,SAAA,EAA+F;AACvI,EAAA,KAAA,MAAW,KAAA,IAASA,yCAAA,CAAmB,SAAS,CAAA,EAAG;AAClD,IAAA,OAAOA,0CAAmB,KAAK,CAAA;AAAA,EAChC;AACD;AAJiB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"flat.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable in the input iterable.\n *\n * @param iterables An iterator to map.\n * @returns An iterator that yields the entries of each iterator.\n *\n * @example\n * ```typescript\n * import { flat } from '@sapphire/iterator-utilities';\n *\n * const iterable = flat([[1, 2], [3, 4], [5, 6]]);\n * console.log([...iterable]);\n * // Output: [1, 2, 3, 4, 5, 6]\n * ```\n */\nexport function* flat<const ElementType>(iterables: IterableResolvable<IterableResolvable<ElementType>>): IterableIterator<ElementType> {\n\tfor (const value of toIterableIterator(iterables)) {\n\t\tyield* toIterableIterator(value);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/flatMap.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAoBO,UAAU,OAAA,CAChB,UACA,UAC+B,EAAA;AAC/B,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAA,OAAOA,yCAAmB,CAAA,UAAA,CAAW,KAAO,EAAA,KAAA,EAAO,CAAC,CAAA;AAAA;AAEtD;AAViB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"flatMap.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable returned by the provided function on each element of the input iterable.\n *\n * @param iterable An iterator to map.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return an iterator or iterable that yields elements to be yielded by `flatMap()`, or a single non-iterator/iterable value to be yielded.\n * @returns An iterator that applies a function to each element of the input iterator and yields the results.\n *\n * @example\n * ```typescript\n * import { flatMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3];\n * console.log([...flatMap(iterable, (value) => [value, value * 2])]);\n * // Output: [1, 2, 2, 4, 3, 6]\n * ```\n */\nexport function* flatMap<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => IterableResolvable<MappedType>\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield* toIterableIterator(callbackFn(value, index++));\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/flatMap.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAoBO,UAAU,OAAA,CAChB,UACA,UAAA,EAC+B;AAC/B,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,OAAOA,yCAAA,CAAmB,UAAA,CAAW,KAAA,EAAO,KAAA,EAAO,CAAC,CAAA;AAAA,EACrD;AACD;AAViB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"flatMap.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable that yields the elements of each iterable returned by the provided function on each element of the input iterable.\n *\n * @param iterable An iterator to map.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return an iterator or iterable that yields elements to be yielded by `flatMap()`, or a single non-iterator/iterable value to be yielded.\n * @returns An iterator that applies a function to each element of the input iterator and yields the results.\n *\n * @example\n * ```typescript\n * import { flatMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3];\n * console.log([...flatMap(iterable, (value) => [value, value * 2])]);\n * // Output: [1, 2, 2, 4, 3, 6]\n * ```\n */\nexport function* flatMap<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => IterableResolvable<MappedType>\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield* toIterableIterator(callbackFn(value, index++));\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/forEach.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAuBO,SAAS,OAAA,CACf,UACA,UACO,EAAA;AACP,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAA,UAAA,CAAW,SAAS,KAAO,EAAA,CAAA;AAAA;AAE7B;AAVgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"forEach.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Executes a provided function once for each iterable element.\n *\n * @param iterable An iterator to iterate over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is discarded.\n *\n * @example\n * ```typescript\n * import { forEach } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * forEach(iterable, (value) => console.log(value));\n * // Output: 1, 2, 3, 4, 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function forEach<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): void {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tcallbackFn(element, index++);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/forEach.ts"],"names":["assertFunction","toIterableIterator"],"mappings":";;;;;;;AAuBO,SAAS,OAAA,CACf,UACA,UAAA,EACO;AACP,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,UAAA,CAAW,SAAS,KAAA,EAAO,CAAA;AAAA,EAC5B;AACD;AAVgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"forEach.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Executes a provided function once for each iterable element.\n *\n * @param iterable An iterator to iterate over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is discarded.\n *\n * @example\n * ```typescript\n * import { forEach } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * forEach(iterable, (value) => console.log(value));\n * // Output: 1, 2, 3, 4, 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function forEach<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): void {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tcallbackFn(element, index++);\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/from.ts"],"names":[],"mappings":";;;;;;AAmBO,SAAS,KAAK,KAAY,EAAA;AAChC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,KAAA,KAAU,IAAM,EAAA;AAChD,IAAA,IAAI,OAAO,KAAA,CAAM,MAAO,CAAA,QAAQ,MAAM,UAAY,EAAA;AACjD,MAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA;AAAA;AAG/B,IAAI,IAAA,OAAO,KAAM,CAAA,IAAA,KAAS,UAAY,EAAA;AACrC,MAAO,OAAA,KAAA;AAAA;AACR;AAGD,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC9B,IAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA;AAAA;AAG/B,EAAA,MAAM,IAAI,SAAU,CAAA,CAAA,EAAG,MAAO,CAAA,KAAK,CAAC,CAAqC,mCAAA,CAAA,CAAA;AAC1E;AAhBgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"from.cjs","sourcesContent":["/**\n * Resolves an iterable from an iterable or iterator-like object.\n *\n * @param value The value to convert to an iterator.\n *\n * @example\n * ```typescript\n * import { from } from '@sapphire/iterator-utilities';\n *\n * const iterable = from([1, 2, 3, 4, 5]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 4, 5\n * }\n * ```\n */\nexport function from<const ElementType, const ResolvableType extends IterableResolvable<ElementType>>(\n\tvalue: ResolvableType\n): IterableResolved<ResolvableType>;\nexport function from(value: any) {\n\tif (typeof value === 'object' && value !== null) {\n\t\tif (typeof value[Symbol.iterator] === 'function') {\n\t\t\treturn value[Symbol.iterator]();\n\t\t}\n\n\t\tif (typeof value.next === 'function') {\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tif (typeof value === 'string') {\n\t\treturn value[Symbol.iterator]();\n\t}\n\n\tthrow new TypeError(`${String(value)} cannot be converted to an iterable`);\n}\n\nexport type IterableResolvable<ElementType> = Iterable<ElementType> | Iterator<ElementType> | IterableIterator<ElementType>;\n\nexport type IterableResolved<Type> =\n\tType extends IterableIterator<infer Output>\n\t\t? IterableIterator<Output>\n\t\t: Type extends Iterable<infer Output>\n\t\t\t? Iterator<Output>\n\t\t\t: Type extends Iterator<infer Output>\n\t\t\t\t? Iterator<Output>\n\t\t\t\t: never;\n"]}
1
+ {"version":3,"sources":["../../../src/lib/from.ts"],"names":[],"mappings":";;;;;;AAmBO,SAAS,KAAK,KAAA,EAAY;AAChC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,EAAM;AAChD,IAAA,IAAI,OAAO,KAAA,CAAM,MAAA,CAAO,QAAQ,MAAM,UAAA,EAAY;AACjD,MAAA,OAAO,KAAA,CAAM,MAAA,CAAO,QAAQ,CAAA,EAAE;AAAA,IAC/B;AAEA,IAAA,IAAI,OAAO,KAAA,CAAM,IAAA,KAAS,UAAA,EAAY;AACrC,MAAA,OAAO,KAAA;AAAA,IACR;AAAA,EACD;AAEA,EAAA,IAAI,OAAO,UAAU,QAAA,EAAU;AAC9B,IAAA,OAAO,KAAA,CAAM,MAAA,CAAO,QAAQ,CAAA,EAAE;AAAA,EAC/B;AAEA,EAAA,MAAM,IAAI,SAAA,CAAU,CAAA,EAAG,MAAA,CAAO,KAAK,CAAC,CAAA,mCAAA,CAAqC,CAAA;AAC1E;AAhBgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"from.cjs","sourcesContent":["/**\n * Resolves an iterable from an iterable or iterator-like object.\n *\n * @param value The value to convert to an iterator.\n *\n * @example\n * ```typescript\n * import { from } from '@sapphire/iterator-utilities';\n *\n * const iterable = from([1, 2, 3, 4, 5]);\n * for (const element of iterable) {\n * \tconsole.log(element);\n * \t// Output: 1, 2, 3, 4, 5\n * }\n * ```\n */\nexport function from<const ElementType, const ResolvableType extends IterableResolvable<ElementType>>(\n\tvalue: ResolvableType\n): IterableResolved<ResolvableType>;\nexport function from(value: any) {\n\tif (typeof value === 'object' && value !== null) {\n\t\tif (typeof value[Symbol.iterator] === 'function') {\n\t\t\treturn value[Symbol.iterator]();\n\t\t}\n\n\t\tif (typeof value.next === 'function') {\n\t\t\treturn value;\n\t\t}\n\t}\n\n\tif (typeof value === 'string') {\n\t\treturn value[Symbol.iterator]();\n\t}\n\n\tthrow new TypeError(`${String(value)} cannot be converted to an iterable`);\n}\n\nexport type IterableResolvable<ElementType> = Iterable<ElementType> | Iterator<ElementType> | IterableIterator<ElementType>;\n\nexport type IterableResolved<Type> =\n\tType extends IterableIterator<infer Output>\n\t\t? IterableIterator<Output>\n\t\t: Type extends Iterable<infer Output>\n\t\t\t? Iterator<Output>\n\t\t\t: Type extends Iterator<infer Output>\n\t\t\t\t? Iterator<Output>\n\t\t\t\t: never;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/fuse.ts"],"names":["toIterableIterator","makeIterableIterator"],"mappings":";;;;;;;AA8CO,SAAS,KAAwB,QAA0E,EAAA;AACjH,EAAA,IAAI,KAAQ,GAAA,KAAA;AACZ,EAAM,MAAA,QAAA,GAAWA,0CAAmB,QAAQ,CAAA;AAC5C,EAAA,OAAOC,+CAAqB,MAAM;AACjC,IAAA,IAAI,KAAO,EAAA;AACV,MAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,MAAU,EAAA;AAAA;AAGvC,IAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,IAAA,IAAI,OAAO,IAAM,EAAA;AAChB,MAAQ,KAAA,GAAA,IAAA;AAAA;AAGT,IAAO,OAAA,MAAA;AAAA,GACP,CAAA;AACF;AAfgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"fuse.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterator which ends after the first `done` result from the original iterator.\n *\n * After an iterator returns a `done` result, future calls may or may not yield additional results again. This function\n * adapts an iterator, ensuring that after a `done` result is given, it will always return a `done` result forever.\n *\n * @param iterable An iterator to fuse.\n *\n * @example\n * ```typescript\n * import { fuse } from '@sapphire/iterator-utilities';\n *\n * const iterable = {\n * state: 0,\n * next() {\n * const value = this.state;\n * this.state += 1;\n *\n * return value % 2 === 0 //\n * ? { done: false, value }\n * : { done: true, value: undefined };\n * }\n * };\n *\n * // We can see our iterator going back and forth\n * assert(iterable.next(), { done: false, value: 0 });\n * assert(iterable.next(), { done: true, value: undefined });\n * assert(iterable.next(), { done: false, value: 2 });\n * assert(iterable.next(), { done: true, value: undefined });\n *\n * // However, once we fuse it...\n * const fused = fuse(iterable);\n *\n * assert(fused.next(), { done: false, value: 4 });\n * assert(fused.next(), { done: true, value: undefined });\n *\n * // It will always return a `done` result after the first time\n * assert(fused.next(), { done: true, value: undefined });\n * assert(fused.next(), { done: true, value: undefined });\n * assert(fused.next(), { done: true, value: undefined });\n * ```\n */\nexport function fuse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tlet ended = false;\n\tconst iterator = toIterableIterator(iterable);\n\treturn makeIterableIterator(() => {\n\t\tif (ended) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\tconst result = iterator.next();\n\t\tif (result.done) {\n\t\t\tended = true;\n\t\t}\n\n\t\treturn result;\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/fuse.ts"],"names":["toIterableIterator","makeIterableIterator"],"mappings":";;;;;;;AA8CO,SAAS,KAAwB,QAAA,EAA0E;AACjH,EAAA,IAAI,KAAA,GAAQ,KAAA;AACZ,EAAA,MAAM,QAAA,GAAWA,0CAAmB,QAAQ,CAAA;AAC5C,EAAA,OAAOC,+CAAqB,MAAM;AACjC,IAAA,IAAI,KAAA,EAAO;AACV,MAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU;AAAA,IACvC;AAEA,IAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,IAAA,IAAI,OAAO,IAAA,EAAM;AAChB,MAAA,KAAA,GAAQ,IAAA;AAAA,IACT;AAEA,IAAA,OAAO,MAAA;AAAA,EACR,CAAC,CAAA;AACF;AAfgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"fuse.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterator which ends after the first `done` result from the original iterator.\n *\n * After an iterator returns a `done` result, future calls may or may not yield additional results again. This function\n * adapts an iterator, ensuring that after a `done` result is given, it will always return a `done` result forever.\n *\n * @param iterable An iterator to fuse.\n *\n * @example\n * ```typescript\n * import { fuse } from '@sapphire/iterator-utilities';\n *\n * const iterable = {\n * state: 0,\n * next() {\n * const value = this.state;\n * this.state += 1;\n *\n * return value % 2 === 0 //\n * ? { done: false, value }\n * : { done: true, value: undefined };\n * }\n * };\n *\n * // We can see our iterator going back and forth\n * assert(iterable.next(), { done: false, value: 0 });\n * assert(iterable.next(), { done: true, value: undefined });\n * assert(iterable.next(), { done: false, value: 2 });\n * assert(iterable.next(), { done: true, value: undefined });\n *\n * // However, once we fuse it...\n * const fused = fuse(iterable);\n *\n * assert(fused.next(), { done: false, value: 4 });\n * assert(fused.next(), { done: true, value: undefined });\n *\n * // It will always return a `done` result after the first time\n * assert(fused.next(), { done: true, value: undefined });\n * assert(fused.next(), { done: true, value: undefined });\n * assert(fused.next(), { done: true, value: undefined });\n * ```\n */\nexport function fuse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tlet ended = false;\n\tconst iterator = toIterableIterator(iterable);\n\treturn makeIterableIterator(() => {\n\t\tif (ended) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\tconst result = iterator.next();\n\t\tif (result.done) {\n\t\t\tended = true;\n\t\t}\n\n\t\treturn result;\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/greaterOrEqualThan.ts"],"names":["compare","orderingIsLess"],"mappings":";;;;;;;AA+BO,SAAS,kBAAA,CAAsC,UAA2C,KAAiD,EAAA;AACjJ,EAAM,MAAA,MAAA,GAASA,mBAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAO,OAAA,CAACC,4BAAe,MAAM,CAAA;AAC9B;AAHgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA","file":"greaterOrEqualThan.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} greater or equal than\n * those of another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterOrEqualThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterOrEqualThan([1], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterOrEqualThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1, 2], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterOrEqualThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn !orderingIsLess(result);\n}\n\nexport { greaterOrEqualThan as ge };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/greaterOrEqualThan.ts"],"names":["compare","orderingIsLess"],"mappings":";;;;;;;AA+BO,SAAS,kBAAA,CAAsC,UAA2C,KAAA,EAAiD;AACjJ,EAAA,MAAM,MAAA,GAASA,mBAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAO,CAACC,4BAAe,MAAM,CAAA;AAC9B;AAHgB,MAAA,CAAA,kBAAA,EAAA,oBAAA,CAAA","file":"greaterOrEqualThan.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} greater or equal than\n * those of another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterOrEqualThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterOrEqualThan([1], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterOrEqualThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterOrEqualThan([1, 2], [1, 2]));\n * // Output: true\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterOrEqualThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn !orderingIsLess(result);\n}\n\nexport { greaterOrEqualThan as ge };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/greaterThan.ts"],"names":["compare","orderingIsGreater"],"mappings":";;;;;;;AA+BO,SAAS,WAAA,CAA+B,UAA2C,KAAiD,EAAA;AAC1I,EAAM,MAAA,MAAA,GAASA,mBAAQ,CAAA,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAOC,+BAAkB,MAAM,CAAA;AAChC;AAHgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"greaterThan.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} greater than those of\n * another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterThan([1], [1]));\n * // Output: false\n * console.log(greaterThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterThan([1, 2], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn orderingIsGreater(result);\n}\n\nexport { greaterThan as gt };\n"]}
1
+ {"version":3,"sources":["../../../src/lib/greaterThan.ts"],"names":["compare","orderingIsGreater"],"mappings":";;;;;;;AA+BO,SAAS,WAAA,CAA+B,UAA2C,KAAA,EAAiD;AAC1I,EAAA,MAAM,MAAA,GAASA,mBAAA,CAAQ,QAAA,EAAU,KAAK,CAAA;AACtC,EAAA,OAAOC,+BAAkB,MAAM,CAAA;AAChC;AAHgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"greaterThan.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} greater than those of\n * another.\n *\n * @param iterable The iterator to compare.\n * @param other The iterator to compare against.\n *\n * @example\n * ```typescript\n * import { greaterThan } from '@sapphire/iterator-utilities';\n *\n * const x = [1, 2, 3, 4];\n * const y = [1, 4, 9, 16];\n * console.log(greaterThan([1], [1]));\n * // Output: false\n * console.log(greaterThan([1], [1, 2]));\n * // Output: false\n * console.log(greaterThan([1, 2], [1]));\n * // Output: true\n * console.log(greaterThan([1, 2], [1, 2]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function greaterThan<const ElementType>(iterable: IterableResolvable<ElementType>, other: IterableResolvable<ElementType>): boolean {\n\tconst result = compare(iterable, other);\n\treturn orderingIsGreater(result);\n}\n\nexport { greaterThan as gt };\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/indexOf.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAuBO,SAAS,OAAA,CAA2B,UAA2C,KAA4B,EAAA;AACjH,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAW,KAAA,MAAA,OAAA,IAAWA,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACnD,IAAA,IAAI,YAAY,KAAO,EAAA;AACtB,MAAO,OAAA,KAAA;AAAA;AAGR,IAAA,KAAA,EAAA;AAAA;AAGD,EAAO,OAAA,EAAA;AACR;AAXgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"indexOf.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning its index if it's found and `-1` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param value The value to search for.\n * @returns The index of the first occurrence of the value in the iterator, or `-1` if the value is not found.\n *\n * @example\n * ```typescript\n * import { indexOf } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(indexOf(iterable, 3));\n * // Output: 2\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function indexOf<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): number {\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) {\n\t\t\treturn index;\n\t\t}\n\n\t\tindex++;\n\t}\n\n\treturn -1;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/indexOf.ts"],"names":["toIterableIterator"],"mappings":";;;;;;AAuBO,SAAS,OAAA,CAA2B,UAA2C,KAAA,EAA4B;AACjH,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,OAAA,IAAWA,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACnD,IAAA,IAAI,YAAY,KAAA,EAAO;AACtB,MAAA,OAAO,KAAA;AAAA,IACR;AAEA,IAAA,KAAA,EAAA;AAAA,EACD;AAEA,EAAA,OAAO,EAAA;AACR;AAXgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"indexOf.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds the element, returning its index if it's found and `-1` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param value The value to search for.\n * @returns The index of the first occurrence of the value in the iterator, or `-1` if the value is not found.\n *\n * @example\n * ```typescript\n * import { indexOf } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(indexOf(iterable, 3));\n * // Output: 2\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function indexOf<const ElementType>(iterable: IterableResolvable<ElementType>, value: ElementType): number {\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tif (element === value) {\n\t\t\treturn index;\n\t\t}\n\n\t\tindex++;\n\t}\n\n\treturn -1;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/inspect.ts"],"names":["assertFunction","from","makeIterableIterator"],"mappings":";;;;;;;;AAsCO,SAAS,OAAA,CACf,UACA,UACgC,EAAA;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAM,MAAA,QAAA,GAAWC,cAAK,QAAQ,CAAA;AAC9B,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,IAAI,IAAA,CAAC,OAAO,IAAM,EAAA;AACjB,MAAW,UAAA,CAAA,MAAA,CAAO,OAAO,KAAO,EAAA,CAAA;AAAA;AAGjC,IAAO,OAAA,MAAA;AAAA,GACP,CAAA;AACF;AAhBgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"inspect.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Does something with each element of an iterator, passing the value on.\n *\n * When using iterators, you'll often chain several of them together. While working on such code, you might want to\n * check out what's happening at various parts in the pipeline. To do that, insert a call to this function.\n *\n * It's more common for this function to be used as a debugging tool than to exist in your final code, but applications\n * may find it useful in certain situations when errors need to be logged before being discarded.\n *\n * @param iterable An iterator to inspect.\n *\n * @example\n * ```typescript\n * import { inspect } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 4, 2, 3];\n *\n * let iter = inspect(iter, (value) => console.log(`about to filter: ${value}`));\n * iter = filter(iterable, (value) => value % 2 === 0);\n * iter = inspect(iter, (value) => console.log(`made it through filter: ${value}`));\n *\n * const sum = reduce(iter, (acc, value) => acc + value, 0);\n * console.log(sum);\n *\n * // Output:\n * // about to filter: 1\n * // about to filter: 4\n * // made it through filter: 4\n * // about to filter: 2\n * // made it through filter: 2\n * // about to filter: 3\n * // 6\n * ```\n */\nexport function inspect<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tconst result = iterator.next();\n\t\tif (!result.done) {\n\t\t\tcallbackFn(result.value, index++);\n\t\t}\n\n\t\treturn result;\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/inspect.ts"],"names":["assertFunction","from","makeIterableIterator"],"mappings":";;;;;;;;AAsCO,SAAS,OAAA,CACf,UACA,UAAA,EACgC;AAChC,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,MAAM,QAAA,GAAWC,cAAK,QAAQ,CAAA;AAC9B,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,IAAA,IAAI,CAAC,OAAO,IAAA,EAAM;AACjB,MAAA,UAAA,CAAW,MAAA,CAAO,OAAO,KAAA,EAAO,CAAA;AAAA,IACjC;AAEA,IAAA,OAAO,MAAA;AAAA,EACR,CAAC,CAAA;AACF;AAhBgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"inspect.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Does something with each element of an iterator, passing the value on.\n *\n * When using iterators, you'll often chain several of them together. While working on such code, you might want to\n * check out what's happening at various parts in the pipeline. To do that, insert a call to this function.\n *\n * It's more common for this function to be used as a debugging tool than to exist in your final code, but applications\n * may find it useful in certain situations when errors need to be logged before being discarded.\n *\n * @param iterable An iterator to inspect.\n *\n * @example\n * ```typescript\n * import { inspect } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 4, 2, 3];\n *\n * let iter = inspect(iter, (value) => console.log(`about to filter: ${value}`));\n * iter = filter(iterable, (value) => value % 2 === 0);\n * iter = inspect(iter, (value) => console.log(`made it through filter: ${value}`));\n *\n * const sum = reduce(iter, (acc, value) => acc + value, 0);\n * console.log(sum);\n *\n * // Output:\n * // about to filter: 1\n * // about to filter: 4\n * // made it through filter: 4\n * // about to filter: 2\n * // made it through filter: 2\n * // about to filter: 3\n * // 6\n * ```\n */\nexport function inspect<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => void\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tconst result = iterator.next();\n\t\tif (!result.done) {\n\t\t\tcallbackFn(result.value, index++);\n\t\t}\n\n\t\treturn result;\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/intersect.ts"],"names":["toIterableIterator","filter"],"mappings":";;;;;;;AAyBO,SAAS,SAAA,CACf,OACA,MACgC,EAAA;AAChC,EAAA,MAAM,GAAM,GAAA,IAAI,GAAI,CAAAA,yCAAA,CAAmB,MAAM,CAAC,CAAA;AAC9C,EAAA,OAAOC,kBAAO,KAAO,EAAA,CAAC,UAAU,GAAI,CAAA,GAAA,CAAI,KAAK,CAAC,CAAA;AAC/C;AANgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"intersect.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in both input iterables.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to include in the result.\n *\n * @example\n * ```typescript\n * import { intersect } from '@sapphire/iterator-utilities';\n *\n * const iterable = intersect([1, 2, 3, 4, 5], [3, 4, 5, 6, 7]);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to intersect with `first`.\n *\n * @seealso {@link difference} for the opposite behavior.\n */\nexport function intersect<const ElementType>(\n\tfirst: IterableResolvable<ElementType>,\n\tsecond: IterableResolvable<ElementType>\n): IterableIterator<ElementType> {\n\tconst set = new Set(toIterableIterator(second));\n\treturn filter(first, (value) => set.has(value));\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/intersect.ts"],"names":["toIterableIterator","filter"],"mappings":";;;;;;;AAyBO,SAAS,SAAA,CACf,OACA,MAAA,EACgC;AAChC,EAAA,MAAM,GAAA,GAAM,IAAI,GAAA,CAAIA,yCAAA,CAAmB,MAAM,CAAC,CAAA;AAC9C,EAAA,OAAOC,kBAAO,KAAA,EAAO,CAAC,UAAU,GAAA,CAAI,GAAA,CAAI,KAAK,CAAC,CAAA;AAC/C;AANgB,MAAA,CAAA,SAAA,EAAA,WAAA,CAAA","file":"intersect.cjs","sourcesContent":["import { filter } from './filter';\nimport type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in both input iterables.\n *\n * @param first An iterator to return elements from.\n * @param second An iterator that contains elements to include in the result.\n *\n * @example\n * ```typescript\n * import { intersect } from '@sapphire/iterator-utilities';\n *\n * const iterable = intersect([1, 2, 3, 4, 5], [3, 4, 5, 6, 7]);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire `second` iterator to build the set of elements to intersect with `first`.\n *\n * @seealso {@link difference} for the opposite behavior.\n */\nexport function intersect<const ElementType>(\n\tfirst: IterableResolvable<ElementType>,\n\tsecond: IterableResolvable<ElementType>\n): IterableIterator<ElementType> {\n\tconst set = new Set(toIterableIterator(second));\n\treturn filter(first, (value) => set.has(value));\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/intersperse.ts"],"names":["from","makeIterableIterator"],"mappings":";;;;;;;AA4BO,SAAS,WAAA,CAA+B,UAA2C,SAAuD,EAAA;AAChJ,EAAA,IAAI,OAAU,GAAA,KAAA;AACd,EAAI,IAAA,QAAA;AACJ,EAAA,IAAI,aAAgB,GAAA,KAAA;AAEpB,EAAM,MAAA,QAAA,GAAWA,cAAK,QAAQ,CAAA;AAC9B,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAA,IAAI,OAAS,EAAA;AACZ,MAAA,IAAI,aAAe,EAAA;AAClB,QAAgB,aAAA,GAAA,KAAA;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAO,QAAS,EAAA;AAAA;AAGvC,MAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,MAAA,IAAI,OAAO,IAAM,EAAA;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,IAAM,EAAA,KAAA,EAAO,MAAU,EAAA;AAAA;AAGvC,MAAA,QAAA,GAAW,MAAO,CAAA,KAAA;AAClB,MAAgB,aAAA,GAAA,IAAA;AAChB,MAAA,OAAO,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAO,SAAU,EAAA;AAAA;AAGxC,IAAU,OAAA,GAAA,IAAA;AACV,IAAA,OAAO,SAAS,IAAK,EAAA;AAAA,GACrB,CAAA;AACF;AA1BgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"intersperse.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates a new iterator which places `separator` between adjacent items of the original iterator.\n *\n * @param iterable An iterator to map over.\n * @param separator The separator to place between adjacent items.\n *\n * @example\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = [0, 1, 2];\n * console.log([...intersperse(iterable, 100)]);\n * // Output: [0, 100, 1, 100, 2]\n * ```\n *\n * @example\n * `intersperse` can be very useful to join an iterator's items using a common element:\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['Hello', 'World', '!'];\n * console.log([...intersperse(iterable, ', ')].join(''));\n * // Output: 'Hello, World, !'\n * ```\n */\nexport function intersperse<const ElementType>(iterable: IterableResolvable<ElementType>, separator: ElementType): IterableIterator<ElementType> {\n\tlet started = false;\n\tlet nextItem: ElementType;\n\tlet nextItemTaken = false;\n\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (started) {\n\t\t\tif (nextItemTaken) {\n\t\t\t\tnextItemTaken = false;\n\t\t\t\treturn { done: false, value: nextItem };\n\t\t\t}\n\n\t\t\tconst result = iterator.next();\n\t\t\tif (result.done) {\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\n\t\t\tnextItem = result.value;\n\t\t\tnextItemTaken = true;\n\t\t\treturn { done: false, value: separator };\n\t\t}\n\n\t\tstarted = true;\n\t\treturn iterator.next();\n\t});\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/intersperse.ts"],"names":["from","makeIterableIterator"],"mappings":";;;;;;;AA4BO,SAAS,WAAA,CAA+B,UAA2C,SAAA,EAAuD;AAChJ,EAAA,IAAI,OAAA,GAAU,KAAA;AACd,EAAA,IAAI,QAAA;AACJ,EAAA,IAAI,aAAA,GAAgB,KAAA;AAEpB,EAAA,MAAM,QAAA,GAAWA,cAAK,QAAQ,CAAA;AAC9B,EAAA,OAAOC,+CAAkC,MAAM;AAC9C,IAAA,IAAI,OAAA,EAAS;AACZ,MAAA,IAAI,aAAA,EAAe;AAClB,QAAA,aAAA,GAAgB,KAAA;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,QAAA,EAAS;AAAA,MACvC;AAEA,MAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,MAAA,IAAI,OAAO,IAAA,EAAM;AAChB,QAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,MAAA,EAAU;AAAA,MACvC;AAEA,MAAA,QAAA,GAAW,MAAA,CAAO,KAAA;AAClB,MAAA,aAAA,GAAgB,IAAA;AAChB,MAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,SAAA,EAAU;AAAA,IACxC;AAEA,IAAA,OAAA,GAAU,IAAA;AACV,IAAA,OAAO,SAAS,IAAA,EAAK;AAAA,EACtB,CAAC,CAAA;AACF;AA1BgB,MAAA,CAAA,WAAA,EAAA,aAAA,CAAA","file":"intersperse.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates a new iterator which places `separator` between adjacent items of the original iterator.\n *\n * @param iterable An iterator to map over.\n * @param separator The separator to place between adjacent items.\n *\n * @example\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = [0, 1, 2];\n * console.log([...intersperse(iterable, 100)]);\n * // Output: [0, 100, 1, 100, 2]\n * ```\n *\n * @example\n * `intersperse` can be very useful to join an iterator's items using a common element:\n * ```typescript\n * import { intersperse } from '@sapphire/iterator-utilities';\n *\n * const iterable = ['Hello', 'World', '!'];\n * console.log([...intersperse(iterable, ', ')].join(''));\n * // Output: 'Hello, World, !'\n * ```\n */\nexport function intersperse<const ElementType>(iterable: IterableResolvable<ElementType>, separator: ElementType): IterableIterator<ElementType> {\n\tlet started = false;\n\tlet nextItem: ElementType;\n\tlet nextItemTaken = false;\n\n\tconst iterator = from(iterable);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (started) {\n\t\t\tif (nextItemTaken) {\n\t\t\t\tnextItemTaken = false;\n\t\t\t\treturn { done: false, value: nextItem };\n\t\t\t}\n\n\t\t\tconst result = iterator.next();\n\t\t\tif (result.done) {\n\t\t\t\treturn { done: true, value: undefined };\n\t\t\t}\n\n\t\t\tnextItem = result.value;\n\t\t\tnextItemTaken = true;\n\t\t\treturn { done: false, value: separator };\n\t\t}\n\n\t\tstarted = true;\n\t\treturn iterator.next();\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isEmpty.ts"],"names":["from"],"mappings":";;;;;;AAuBO,SAAS,QAA2B,QAAoD,EAAA;AAC9F,EAAA,OAAOA,aAAK,CAAA,QAAQ,CAAE,CAAA,IAAA,GAAO,IAAQ,IAAA,KAAA;AACtC;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"isEmpty.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Advances the iterable once, returning `true` if it's exhausted and `false` otherwise.\n *\n * @param iterable The iterator to check for emptiness.\n * @returns `true` if the iterator is empty; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { isEmpty } from '@sapphire/iterator-utilities';\n *\n * console.log(isEmpty([]));\n * // Output: true\n *\n * console.log(isEmpty([1, 2, 3, 4, 5]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function isEmpty<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn from(iterable).next().done ?? false;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isEmpty.ts"],"names":["from"],"mappings":";;;;;;AAuBO,SAAS,QAA2B,QAAA,EAAoD;AAC9F,EAAA,OAAOA,aAAA,CAAK,QAAQ,CAAA,CAAE,IAAA,GAAO,IAAA,IAAQ,KAAA;AACtC;AAFgB,MAAA,CAAA,OAAA,EAAA,SAAA,CAAA","file":"isEmpty.cjs","sourcesContent":["import { from, type IterableResolvable } from './from';\n\n/**\n * Advances the iterable once, returning `true` if it's exhausted and `false` otherwise.\n *\n * @param iterable The iterator to check for emptiness.\n * @returns `true` if the iterator is empty; otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { isEmpty } from '@sapphire/iterator-utilities';\n *\n * console.log(isEmpty([]));\n * // Output: true\n *\n * console.log(isEmpty([1, 2, 3, 4, 5]));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the first value of the iterator.\n */\nexport function isEmpty<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn from(iterable).next().done ?? false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isSorted.ts"],"names":["isSortedBy","defaultCompare"],"mappings":";;;;;;;AAmCO,SAAS,SAA4B,QAAoD,EAAA;AAC/F,EAAO,OAAAA,yBAAA,CAAW,UAAUC,8BAAc,CAAA;AAC3C;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"isSorted.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { isSortedBy } from './isSortedBy';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Checks if the elements of this iterator are sorted in ascending order.\n *\n * That is, for each element `a` and its following element `b`, `a <= b` must hold. If the iterator yields exactly zero\n * or one element, `true` is returned.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link isSortedBy} instead.\n *\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { isSorted } from '@sapphire/iterator-utilities';\n *\n * assert(isSorted([1, 2, 2, 9]);\n * assert(!isSorted([1, 3, 2, 4]);\n *\n * assert(isSorted([0]);\n * assert(isSorted([]);\n * assert(isSorted([0, 1, NaN]);\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSorted<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn isSortedBy(iterable, defaultCompare);\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isSorted.ts"],"names":["isSortedBy","defaultCompare"],"mappings":";;;;;;;AAmCO,SAAS,SAA4B,QAAA,EAAoD;AAC/F,EAAA,OAAOA,yBAAA,CAAW,UAAUC,8BAAc,CAAA;AAC3C;AAFgB,MAAA,CAAA,QAAA,EAAA,UAAA,CAAA","file":"isSorted.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { isSortedBy } from './isSortedBy';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { defaultCompare } from './shared/comparators';\n\n/**\n * Checks if the elements of this iterator are sorted in ascending order.\n *\n * That is, for each element `a` and its following element `b`, `a <= b` must hold. If the iterator yields exactly zero\n * or one element, `true` is returned.\n *\n * This function uses the default comparator (lexicographically), which means it will compare the elements as strings.\n * If this is undesirable, use {@link isSortedBy} instead.\n *\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { isSorted } from '@sapphire/iterator-utilities';\n *\n * assert(isSorted([1, 2, 2, 9]);\n * assert(!isSorted([1, 3, 2, 4]);\n *\n * assert(isSorted([0]);\n * assert(isSorted([]);\n * assert(isSorted([0, 1, NaN]);\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSorted<const ElementType>(iterable: IterableResolvable<ElementType>): boolean {\n\treturn isSortedBy(iterable, defaultCompare);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isSortedBy.ts"],"names":["assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;AAiCO,SAAS,UAAA,CAA8B,UAA2C,UAAuD,EAAA;AAC/I,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAWC,0CAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,EAAI,IAAA,MAAA,CAAO,MAAa,OAAA,IAAA;AAExB,EAAA,IAAI,WAAW,MAAO,CAAA,KAAA;AACtB,EAAA,KAAA,MAAW,WAAW,QAAU,EAAA;AAC/B,IAAA,MAAM,UAAa,GAAAC,oCAAA,CAAqC,QAAU,EAAA,OAAA,EAAS,UAAU,CAAA;AACrF,IAAI,IAAAC,8BAAA,CAAkB,UAAU,CAAA,EAAU,OAAA,KAAA;AAE1C,IAAW,QAAA,GAAA,OAAA;AAAA;AAGZ,EAAO,OAAA,IAAA;AACR;AAhBgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"isSortedBy.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given comparator function.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { ascNumber, isSortedBy } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedBy([1, 2, 2, 9], ascNumber));\n * assert(!isSortedBy([1, 2, 2, 9], ascNumber));\n *\n * assert(isSortedBy([0], () => true));\n * assert(isSortedBy([0], () => false));\n *\n * assert(isSortedBy([], () => true));\n * assert(isSortedBy([], () => false));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedBy<const ElementType>(iterable: IterableResolvable<ElementType>, comparator: CompareByComparator<ElementType>): boolean {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previous = result.value;\n\tfor (const current of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(previous, current, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tprevious = current;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isSortedBy.ts"],"names":["assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;AAiCO,SAAS,UAAA,CAA8B,UAA2C,UAAA,EAAuD;AAC/I,EAAA,UAAA,GAAaA,mCAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAWC,0CAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,EAAA,IAAI,MAAA,CAAO,MAAM,OAAO,IAAA;AAExB,EAAA,IAAI,WAAW,MAAA,CAAO,KAAA;AACtB,EAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC/B,IAAA,MAAM,UAAA,GAAaC,oCAAA,CAAqC,QAAA,EAAU,OAAA,EAAS,UAAU,CAAA;AACrF,IAAA,IAAIC,8BAAA,CAAkB,UAAU,CAAA,EAAG,OAAO,KAAA;AAE1C,IAAA,QAAA,GAAW,OAAA;AAAA,EACZ;AAEA,EAAA,OAAO,IAAA;AACR;AAhBgB,MAAA,CAAA,UAAA,EAAA,YAAA,CAAA","file":"isSortedBy.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedByKey } from './isSortedByKey';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given comparator function.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedByKey} for a version that allows custom key extractors.\n *\n * @param iterable The iterator to compare.\n *\n * @example\n * ```typescript\n * import { ascNumber, isSortedBy } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedBy([1, 2, 2, 9], ascNumber));\n * assert(!isSortedBy([1, 2, 2, 9], ascNumber));\n *\n * assert(isSortedBy([0], () => true));\n * assert(isSortedBy([0], () => false));\n *\n * assert(isSortedBy([], () => true));\n * assert(isSortedBy([], () => false));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedBy<const ElementType>(iterable: IterableResolvable<ElementType>, comparator: CompareByComparator<ElementType>): boolean {\n\tcomparator = assertFunction(comparator);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previous = result.value;\n\tfor (const current of iterator) {\n\t\tconst comparison = compareIteratorElements<ElementType>(previous, current, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tprevious = current;\n\t}\n\n\treturn true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/isSortedByKey.ts"],"names":["defaultCompare","assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;;AAgCO,SAAS,aACf,CAAA,QAAA,EACA,UACA,EAAA,UAAA,GAA8CA,8BACpC,EAAA;AACV,EAAA,UAAA,GAAaC,mCAAe,UAAU,CAAA;AAEtC,EAAM,MAAA,QAAA,GAAWC,0CAAmB,QAAQ,CAAA;AAC5C,EAAM,MAAA,MAAA,GAAS,SAAS,IAAK,EAAA;AAC7B,EAAI,IAAA,MAAA,CAAO,MAAa,OAAA,IAAA;AAExB,EAAA,IAAI,WAAc,GAAA,UAAA,CAAW,MAAO,CAAA,KAAA,EAAO,CAAC,CAAA;AAC5C,EAAA,IAAI,KAAQ,GAAA,CAAA;AACZ,EAAA,KAAA,MAAW,WAAW,QAAU,EAAA;AAC/B,IAAM,MAAA,UAAA,GAAa,UAAW,CAAA,OAAA,EAAS,KAAO,EAAA,CAAA;AAC9C,IAAA,MAAM,UAAa,GAAAC,oCAAA,CAAoC,WAAa,EAAA,UAAA,EAAY,UAAU,CAAA;AAC1F,IAAI,IAAAC,8BAAA,CAAkB,UAAU,CAAA,EAAU,OAAA,KAAA;AAE1C,IAAc,WAAA,GAAA,UAAA;AAAA;AAGf,EAAO,OAAA,IAAA;AACR;AAtBgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"isSortedByKey.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedBy } from './isSortedBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given key extraction function.\n *\n * Instead of comparing the iterator's elements directly, this function compares the keys of the elements, as determined\n * by `callbackFn`. Apart from that, it's equivalent to {@link isSorted}; see its documentation for more information.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n *\n * @param iterable The iterator to compare.\n * @param callbackFn The function to extract the key from an element.\n *\n * @example\n * ```typescript\n * import { isSortedByKey } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedByKey(['c', 'bb', 'aaa'], (s) => s.length));\n * assert(!isSortedBy([-2, -1, 0, 3], (n) => Math.abs(n)));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (a: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previousKey = callbackFn(result.value, 0);\n\tlet index = 1;\n\tfor (const current of iterator) {\n\t\tconst currentKey = callbackFn(current, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(previousKey, currentKey, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tpreviousKey = currentKey;\n\t}\n\n\treturn true;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/isSortedByKey.ts"],"names":["defaultCompare","assertFunction","toIterableIterator","compareIteratorElements","orderingIsGreater"],"mappings":";;;;;;;;;AAgCO,SAAS,aAAA,CACf,QAAA,EACA,UAAA,EACA,UAAA,GAA8CA,8BAAA,EACpC;AACV,EAAA,UAAA,GAAaC,mCAAe,UAAU,CAAA;AAEtC,EAAA,MAAM,QAAA,GAAWC,0CAAmB,QAAQ,CAAA;AAC5C,EAAA,MAAM,MAAA,GAAS,SAAS,IAAA,EAAK;AAC7B,EAAA,IAAI,MAAA,CAAO,MAAM,OAAO,IAAA;AAExB,EAAA,IAAI,WAAA,GAAc,UAAA,CAAW,MAAA,CAAO,KAAA,EAAO,CAAC,CAAA;AAC5C,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC/B,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,OAAA,EAAS,KAAA,EAAO,CAAA;AAC9C,IAAA,MAAM,UAAA,GAAaC,oCAAA,CAAoC,WAAA,EAAa,UAAA,EAAY,UAAU,CAAA;AAC1F,IAAA,IAAIC,8BAAA,CAAkB,UAAU,CAAA,EAAG,OAAO,KAAA;AAE1C,IAAA,WAAA,GAAc,UAAA;AAAA,EACf;AAEA,EAAA,OAAO,IAAA;AACR;AAtBgB,MAAA,CAAA,aAAA,EAAA,eAAA,CAAA","file":"isSortedByKey.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport type { isSorted } from './isSorted';\nimport type { isSortedBy } from './isSortedBy';\nimport { assertFunction } from './shared/_assertFunction';\nimport { compareIteratorElements, orderingIsGreater, type CompareByComparator } from './shared/_compare';\nimport { defaultCompare } from './shared/comparators';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Checks if the elements of this iterator are sorted using the given key extraction function.\n *\n * Instead of comparing the iterator's elements directly, this function compares the keys of the elements, as determined\n * by `callbackFn`. Apart from that, it's equivalent to {@link isSorted}; see its documentation for more information.\n *\n * @seealso {@link isSorted} for a version that uses the default comparator.\n * @seealso {@link isSortedBy} for a version that allows custom comparators.\n *\n * @param iterable The iterator to compare.\n * @param callbackFn The function to extract the key from an element.\n *\n * @example\n * ```typescript\n * import { isSortedByKey } from '@sapphire/iterator-utilities';\n *\n * assert(isSortedByKey(['c', 'bb', 'aaa'], (s) => s.length));\n * assert(!isSortedBy([-2, -1, 0, 3], (n) => Math.abs(n)));\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function isSortedByKey<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (a: ElementType, index: number) => MappedType,\n\tcomparator: CompareByComparator<MappedType> = defaultCompare\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tconst iterator = toIterableIterator(iterable);\n\tconst result = iterator.next();\n\tif (result.done) return true;\n\n\tlet previousKey = callbackFn(result.value, 0);\n\tlet index = 1;\n\tfor (const current of iterator) {\n\t\tconst currentKey = callbackFn(current, index++);\n\t\tconst comparison = compareIteratorElements<MappedType>(previousKey, currentKey, comparator);\n\t\tif (orderingIsGreater(comparison)) return false;\n\n\t\tpreviousKey = currentKey;\n\t}\n\n\treturn true;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/last.ts"],"names":["last","toIterableIterator"],"mappings":";;;;;;AAsBO,SAAS,KAAwB,QAAoE,EAAA;AAC3G,EAAIA,IAAAA,KAAAA;AACJ,EAAW,KAAA,MAAA,KAAA,IAASC,yCAAmB,CAAA,QAAQ,CAAG,EAAA;AACjD,IAAAD,KAAO,GAAA,KAAA;AAAA;AAGR,EAAOA,OAAAA,KAAAA;AACR;AAPgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"last.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable until it's exhausted, returning the last element.\n *\n * @param iterable An iterator to return the last value of.\n * @returns The value at the last position in the source iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { last } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(last(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator to find the last value.\n */\nexport function last<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\tlet last: ElementType | undefined;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tlast = value;\n\t}\n\n\treturn last;\n}\n"]}
1
+ {"version":3,"sources":["../../../src/lib/last.ts"],"names":["last","toIterableIterator"],"mappings":";;;;;;AAsBO,SAAS,KAAwB,QAAA,EAAoE;AAC3G,EAAA,IAAIA,KAAAA;AACJ,EAAA,KAAA,MAAW,KAAA,IAASC,yCAAA,CAAmB,QAAQ,CAAA,EAAG;AACjD,IAAAD,KAAAA,GAAO,KAAA;AAAA,EACR;AAEA,EAAA,OAAOA,KAAAA;AACR;AAPgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA","file":"last.cjs","sourcesContent":["import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable until it's exhausted, returning the last element.\n *\n * @param iterable An iterator to return the last value of.\n * @returns The value at the last position in the source iterator, or `undefined` if the iterator is empty.\n *\n * @example\n * ```typescript\n * import { last } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(last(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator to find the last value.\n */\nexport function last<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType | undefined {\n\tlet last: ElementType | undefined;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tlast = value;\n\t}\n\n\treturn last;\n}\n"]}