@sapphire/iterator-utilities 1.0.3-next.ec73e32c → 1.0.3-next.ef2a0072
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.
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/lib/append.cjs +1 -1
- package/dist/cjs/lib/append.cjs.map +1 -1
- package/dist/cjs/lib/at.cjs +1 -1
- package/dist/cjs/lib/at.cjs.map +1 -1
- package/dist/cjs/lib/average.cjs +1 -1
- package/dist/cjs/lib/average.cjs.map +1 -1
- package/dist/cjs/lib/chain.cjs +1 -1
- package/dist/cjs/lib/chain.cjs.map +1 -1
- package/dist/cjs/lib/chunk.cjs +1 -1
- package/dist/cjs/lib/chunk.cjs.map +1 -1
- package/dist/cjs/lib/compact.cjs +1 -1
- package/dist/cjs/lib/compact.cjs.map +1 -1
- package/dist/cjs/lib/compress.cjs +1 -1
- package/dist/cjs/lib/compress.cjs.map +1 -1
- package/dist/cjs/lib/contains.cjs +1 -1
- package/dist/cjs/lib/contains.cjs.map +1 -1
- package/dist/cjs/lib/count.cjs +1 -1
- package/dist/cjs/lib/count.cjs.map +1 -1
- package/dist/cjs/lib/cycle.cjs +1 -1
- package/dist/cjs/lib/cycle.cjs.map +1 -1
- package/dist/cjs/lib/difference.cjs +1 -1
- package/dist/cjs/lib/difference.cjs.map +1 -1
- package/dist/cjs/lib/drop.cjs +1 -1
- package/dist/cjs/lib/drop.cjs.map +1 -1
- package/dist/cjs/lib/dropLast.cjs +1 -1
- package/dist/cjs/lib/dropLast.cjs.map +1 -1
- package/dist/cjs/lib/dropWhile.cjs +1 -1
- package/dist/cjs/lib/dropWhile.cjs.map +1 -1
- package/dist/cjs/lib/empty.cjs +1 -1
- package/dist/cjs/lib/empty.cjs.map +1 -1
- package/dist/cjs/lib/enumerate.cjs +1 -1
- package/dist/cjs/lib/enumerate.cjs.map +1 -1
- package/dist/cjs/lib/every.cjs +1 -1
- package/dist/cjs/lib/every.cjs.map +1 -1
- package/dist/cjs/lib/filter.cjs +1 -1
- package/dist/cjs/lib/filter.cjs.map +1 -1
- package/dist/cjs/lib/find.cjs +1 -1
- package/dist/cjs/lib/find.cjs.map +1 -1
- package/dist/cjs/lib/findIndex.cjs +1 -1
- package/dist/cjs/lib/findIndex.cjs.map +1 -1
- package/dist/cjs/lib/first.cjs +1 -1
- package/dist/cjs/lib/first.cjs.map +1 -1
- package/dist/cjs/lib/flat.cjs +1 -1
- package/dist/cjs/lib/flat.cjs.map +1 -1
- package/dist/cjs/lib/flatMap.cjs +1 -1
- package/dist/cjs/lib/flatMap.cjs.map +1 -1
- package/dist/cjs/lib/forEach.cjs +1 -1
- package/dist/cjs/lib/forEach.cjs.map +1 -1
- package/dist/cjs/lib/from.cjs +1 -1
- package/dist/cjs/lib/from.cjs.map +1 -1
- package/dist/cjs/lib/indexOf.cjs +1 -1
- package/dist/cjs/lib/indexOf.cjs.map +1 -1
- package/dist/cjs/lib/intersect.cjs +1 -1
- package/dist/cjs/lib/intersect.cjs.map +1 -1
- package/dist/cjs/lib/isEmpty.cjs +1 -1
- package/dist/cjs/lib/isEmpty.cjs.map +1 -1
- package/dist/cjs/lib/last.cjs +1 -1
- package/dist/cjs/lib/last.cjs.map +1 -1
- package/dist/cjs/lib/map.cjs +1 -1
- package/dist/cjs/lib/map.cjs.map +1 -1
- package/dist/cjs/lib/max.cjs +1 -1
- package/dist/cjs/lib/max.cjs.map +1 -1
- package/dist/cjs/lib/min.cjs +1 -1
- package/dist/cjs/lib/min.cjs.map +1 -1
- package/dist/cjs/lib/partition.cjs +1 -1
- package/dist/cjs/lib/partition.cjs.map +1 -1
- package/dist/cjs/lib/peekable.cjs +1 -1
- package/dist/cjs/lib/peekable.cjs.map +1 -1
- package/dist/cjs/lib/prepend.cjs +1 -1
- package/dist/cjs/lib/prepend.cjs.map +1 -1
- package/dist/cjs/lib/product.cjs +1 -1
- package/dist/cjs/lib/product.cjs.map +1 -1
- package/dist/cjs/lib/range.cjs +1 -1
- package/dist/cjs/lib/range.cjs.map +1 -1
- package/dist/cjs/lib/reduce.cjs +1 -1
- package/dist/cjs/lib/reduce.cjs.map +1 -1
- package/dist/cjs/lib/repeat.cjs +1 -1
- package/dist/cjs/lib/repeat.cjs.map +1 -1
- package/dist/cjs/lib/reverse.cjs +1 -1
- package/dist/cjs/lib/reverse.cjs.map +1 -1
- package/dist/cjs/lib/shared/_assertFunction.cjs +1 -1
- package/dist/cjs/lib/shared/_assertFunction.cjs.map +1 -1
- package/dist/cjs/lib/shared/_assertNotNegative.cjs +1 -1
- package/dist/cjs/lib/shared/_assertNotNegative.cjs.map +1 -1
- package/dist/cjs/lib/shared/_assertPositive.cjs +1 -1
- package/dist/cjs/lib/shared/_assertPositive.cjs.map +1 -1
- package/dist/cjs/lib/shared/_makeIterableIterator.cjs +1 -1
- package/dist/cjs/lib/shared/_makeIterableIterator.cjs.map +1 -1
- package/dist/cjs/lib/shared/_toIntegerOrInfinityOrThrow.cjs +1 -1
- package/dist/cjs/lib/shared/_toIntegerOrInfinityOrThrow.cjs.map +1 -1
- package/dist/cjs/lib/shared/_toIntegerOrThrow.cjs +1 -1
- package/dist/cjs/lib/shared/_toIntegerOrThrow.cjs.map +1 -1
- package/dist/cjs/lib/shared/_toNumberOrThrow.cjs +1 -1
- package/dist/cjs/lib/shared/_toNumberOrThrow.cjs.map +1 -1
- package/dist/cjs/lib/slice.cjs +1 -1
- package/dist/cjs/lib/slice.cjs.map +1 -1
- package/dist/cjs/lib/some.cjs +1 -1
- package/dist/cjs/lib/some.cjs.map +1 -1
- package/dist/cjs/lib/sorted.cjs +1 -1
- package/dist/cjs/lib/sorted.cjs.map +1 -1
- package/dist/cjs/lib/starMap.cjs +1 -1
- package/dist/cjs/lib/starMap.cjs.map +1 -1
- package/dist/cjs/lib/sum.cjs +1 -1
- package/dist/cjs/lib/sum.cjs.map +1 -1
- package/dist/cjs/lib/take.cjs +1 -1
- package/dist/cjs/lib/take.cjs.map +1 -1
- package/dist/cjs/lib/takeLast.cjs +1 -1
- package/dist/cjs/lib/takeLast.cjs.map +1 -1
- package/dist/cjs/lib/tee.cjs +1 -1
- package/dist/cjs/lib/tee.cjs.map +1 -1
- package/dist/cjs/lib/toArray.cjs +1 -1
- package/dist/cjs/lib/toArray.cjs.map +1 -1
- package/dist/cjs/lib/toIterableIterator.cjs +1 -1
- package/dist/cjs/lib/toIterableIterator.cjs.map +1 -1
- package/dist/cjs/lib/union.cjs +1 -1
- package/dist/cjs/lib/union.cjs.map +1 -1
- package/dist/cjs/lib/unique.cjs +1 -1
- package/dist/cjs/lib/unique.cjs.map +1 -1
- package/dist/cjs/lib/unzip.cjs +1 -1
- package/dist/cjs/lib/unzip.cjs.map +1 -1
- package/dist/cjs/lib/zip.cjs +1 -1
- package/dist/cjs/lib/zip.cjs.map +1 -1
- package/dist/esm/chunk-PAWJFY3S.mjs +1 -1
- package/dist/esm/chunk-PAWJFY3S.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/lib/append.mjs +1 -1
- package/dist/esm/lib/append.mjs.map +1 -1
- package/dist/esm/lib/at.mjs +1 -1
- package/dist/esm/lib/at.mjs.map +1 -1
- package/dist/esm/lib/average.mjs +1 -1
- package/dist/esm/lib/average.mjs.map +1 -1
- package/dist/esm/lib/chain.mjs +1 -1
- package/dist/esm/lib/chain.mjs.map +1 -1
- package/dist/esm/lib/chunk.mjs +1 -1
- package/dist/esm/lib/chunk.mjs.map +1 -1
- package/dist/esm/lib/compact.mjs +1 -1
- package/dist/esm/lib/compact.mjs.map +1 -1
- package/dist/esm/lib/compress.mjs +1 -1
- package/dist/esm/lib/compress.mjs.map +1 -1
- package/dist/esm/lib/contains.mjs +1 -1
- package/dist/esm/lib/contains.mjs.map +1 -1
- package/dist/esm/lib/count.mjs +1 -1
- package/dist/esm/lib/count.mjs.map +1 -1
- package/dist/esm/lib/cycle.mjs +1 -1
- package/dist/esm/lib/cycle.mjs.map +1 -1
- package/dist/esm/lib/difference.mjs +1 -1
- package/dist/esm/lib/difference.mjs.map +1 -1
- package/dist/esm/lib/drop.mjs +1 -1
- package/dist/esm/lib/drop.mjs.map +1 -1
- package/dist/esm/lib/dropLast.mjs +1 -1
- package/dist/esm/lib/dropLast.mjs.map +1 -1
- package/dist/esm/lib/dropWhile.mjs +1 -1
- package/dist/esm/lib/dropWhile.mjs.map +1 -1
- package/dist/esm/lib/empty.mjs +1 -1
- package/dist/esm/lib/empty.mjs.map +1 -1
- package/dist/esm/lib/enumerate.mjs +1 -1
- package/dist/esm/lib/enumerate.mjs.map +1 -1
- package/dist/esm/lib/every.mjs +1 -1
- package/dist/esm/lib/every.mjs.map +1 -1
- package/dist/esm/lib/filter.mjs +1 -1
- package/dist/esm/lib/filter.mjs.map +1 -1
- package/dist/esm/lib/find.mjs +1 -1
- package/dist/esm/lib/find.mjs.map +1 -1
- package/dist/esm/lib/findIndex.mjs +1 -1
- package/dist/esm/lib/findIndex.mjs.map +1 -1
- package/dist/esm/lib/first.mjs +1 -1
- package/dist/esm/lib/first.mjs.map +1 -1
- package/dist/esm/lib/flat.mjs +1 -1
- package/dist/esm/lib/flat.mjs.map +1 -1
- package/dist/esm/lib/flatMap.mjs +1 -1
- package/dist/esm/lib/flatMap.mjs.map +1 -1
- package/dist/esm/lib/forEach.mjs +1 -1
- package/dist/esm/lib/forEach.mjs.map +1 -1
- package/dist/esm/lib/from.mjs +1 -1
- package/dist/esm/lib/from.mjs.map +1 -1
- package/dist/esm/lib/indexOf.mjs +1 -1
- package/dist/esm/lib/indexOf.mjs.map +1 -1
- package/dist/esm/lib/intersect.mjs +1 -1
- package/dist/esm/lib/intersect.mjs.map +1 -1
- package/dist/esm/lib/isEmpty.mjs +1 -1
- package/dist/esm/lib/isEmpty.mjs.map +1 -1
- package/dist/esm/lib/last.mjs +1 -1
- package/dist/esm/lib/last.mjs.map +1 -1
- package/dist/esm/lib/map.mjs +1 -1
- package/dist/esm/lib/map.mjs.map +1 -1
- package/dist/esm/lib/max.mjs +1 -1
- package/dist/esm/lib/max.mjs.map +1 -1
- package/dist/esm/lib/min.mjs +1 -1
- package/dist/esm/lib/min.mjs.map +1 -1
- package/dist/esm/lib/partition.mjs +1 -1
- package/dist/esm/lib/partition.mjs.map +1 -1
- package/dist/esm/lib/peekable.mjs +1 -1
- package/dist/esm/lib/peekable.mjs.map +1 -1
- package/dist/esm/lib/prepend.mjs +1 -1
- package/dist/esm/lib/prepend.mjs.map +1 -1
- package/dist/esm/lib/product.mjs +1 -1
- package/dist/esm/lib/product.mjs.map +1 -1
- package/dist/esm/lib/range.mjs +1 -1
- package/dist/esm/lib/range.mjs.map +1 -1
- package/dist/esm/lib/reduce.mjs +1 -1
- package/dist/esm/lib/reduce.mjs.map +1 -1
- package/dist/esm/lib/repeat.mjs +1 -1
- package/dist/esm/lib/repeat.mjs.map +1 -1
- package/dist/esm/lib/reverse.mjs +1 -1
- package/dist/esm/lib/reverse.mjs.map +1 -1
- package/dist/esm/lib/shared/_assertFunction.mjs +1 -1
- package/dist/esm/lib/shared/_assertFunction.mjs.map +1 -1
- package/dist/esm/lib/shared/_assertNotNegative.mjs +1 -1
- package/dist/esm/lib/shared/_assertNotNegative.mjs.map +1 -1
- package/dist/esm/lib/shared/_assertPositive.mjs +1 -1
- package/dist/esm/lib/shared/_assertPositive.mjs.map +1 -1
- package/dist/esm/lib/shared/_makeIterableIterator.mjs +1 -1
- package/dist/esm/lib/shared/_makeIterableIterator.mjs.map +1 -1
- package/dist/esm/lib/shared/_toIntegerOrInfinityOrThrow.mjs +1 -1
- package/dist/esm/lib/shared/_toIntegerOrInfinityOrThrow.mjs.map +1 -1
- package/dist/esm/lib/shared/_toIntegerOrThrow.mjs +1 -1
- package/dist/esm/lib/shared/_toIntegerOrThrow.mjs.map +1 -1
- package/dist/esm/lib/shared/_toNumberOrThrow.mjs +1 -1
- package/dist/esm/lib/shared/_toNumberOrThrow.mjs.map +1 -1
- package/dist/esm/lib/slice.mjs +1 -1
- package/dist/esm/lib/slice.mjs.map +1 -1
- package/dist/esm/lib/some.mjs +1 -1
- package/dist/esm/lib/some.mjs.map +1 -1
- package/dist/esm/lib/sorted.mjs +1 -1
- package/dist/esm/lib/sorted.mjs.map +1 -1
- package/dist/esm/lib/starMap.mjs +1 -1
- package/dist/esm/lib/starMap.mjs.map +1 -1
- package/dist/esm/lib/sum.mjs +1 -1
- package/dist/esm/lib/sum.mjs.map +1 -1
- package/dist/esm/lib/take.mjs +1 -1
- package/dist/esm/lib/take.mjs.map +1 -1
- package/dist/esm/lib/takeLast.mjs +1 -1
- package/dist/esm/lib/takeLast.mjs.map +1 -1
- package/dist/esm/lib/tee.mjs +1 -1
- package/dist/esm/lib/tee.mjs.map +1 -1
- package/dist/esm/lib/toArray.mjs +1 -1
- package/dist/esm/lib/toArray.mjs.map +1 -1
- package/dist/esm/lib/toIterableIterator.mjs +1 -1
- package/dist/esm/lib/toIterableIterator.mjs.map +1 -1
- package/dist/esm/lib/union.mjs +1 -1
- package/dist/esm/lib/union.mjs.map +1 -1
- package/dist/esm/lib/unique.mjs +1 -1
- package/dist/esm/lib/unique.mjs.map +1 -1
- package/dist/esm/lib/unzip.mjs +1 -1
- package/dist/esm/lib/unzip.mjs.map +1 -1
- package/dist/esm/lib/zip.mjs +1 -1
- package/dist/esm/lib/zip.mjs.map +1 -1
- package/dist/iife/index.global.js +1 -1
- package/dist/iife/index.global.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/from.ts","../../src/lib/shared/_makeIterableIterator.ts","../../src/lib/toIterableIterator.ts","../../src/lib/chain.ts","../../src/lib/append.ts","../../src/lib/empty.ts","../../src/lib/shared/_assertNotNegative.ts","../../src/lib/shared/_toNumberOrThrow.ts","../../src/lib/shared/_toIntegerOrInfinityOrThrow.ts","../../src/lib/drop.ts","../../src/lib/first.ts","../../src/lib/at.ts","../../src/lib/shared/_assertFunction.ts","../../src/lib/map.ts","../../src/lib/average.ts","../../src/lib/shared/_assertPositive.ts","../../src/lib/shared/_toIntegerOrThrow.ts","../../src/lib/chunk.ts","../../src/lib/filter.ts","../../src/lib/compact.ts","../../src/lib/compress.ts","../../src/lib/contains.ts","../../src/lib/count.ts","../../src/lib/cycle.ts","../../src/lib/difference.ts","../../src/lib/take.ts","../../src/lib/toArray.ts","../../src/lib/dropLast.ts","../../src/lib/dropWhile.ts","../../src/lib/enumerate.ts","../../src/lib/every.ts","../../src/lib/find.ts","../../src/lib/findIndex.ts","../../src/lib/flat.ts","../../src/lib/flatMap.ts","../../src/lib/forEach.ts","../../src/lib/indexOf.ts","../../src/lib/intersect.ts","../../src/lib/isEmpty.ts","../../src/lib/last.ts","../../src/lib/max.ts","../../src/lib/min.ts","../../src/lib/partition.ts","../../src/lib/peekable.ts","../../src/lib/prepend.ts","../../src/lib/product.ts","../../src/lib/range.ts","../../src/lib/reduce.ts","../../src/lib/repeat.ts","../../src/lib/reverse.ts","../../src/lib/takeLast.ts","../../src/lib/slice.ts","../../src/lib/some.ts","../../src/lib/sorted.ts","../../src/lib/starMap.ts","../../src/lib/sum.ts","../../src/lib/tee.ts","../../src/lib/union.ts","../../src/lib/unique.ts","../../src/lib/unzip.ts","../../src/lib/zip.ts"],"names":["count","sum","first","last","max","min","iterable"],"mappings":";;;;AAmBO,SAAS,KAAK,OAAY;AAChC,MAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAChD,QAAI,OAAO,MAAM,OAAO,QAAQ,MAAM,YAAY;AACjD,aAAO,MAAM,OAAO,QAAQ,EAAE;AAAA,IAC/B;AAEA,QAAI,OAAO,MAAM,SAAS,YAAY;AACrC,aAAO;AAAA,IACR;AAAA,EACD;AAEA,MAAI,OAAO,UAAU,UAAU;AAC9B,WAAO,MAAM,OAAO,QAAQ,EAAE;AAAA,EAC/B;AAEA,QAAM,IAAI,UAAU,GAAG,OAAO,KAAK,CAAC,qCAAqC;AAC1E;AAhBgB;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C9B,cAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;AAAA,IAC3B;AAAA,EACD;AAEA,SAAO;AACR;AA7BgB;;;ACHT,UAAU,OAAmE,WAA+C;AAClI,QAAM,oBAAoB,UAAU,IAAI,CAAC,aAAa,KAAK,QAAQ,CAAC;AACpE,SAAO,MAAM;AACZ,UAAM,UAAU,CAAC;AACjB,eAAW,oBAAoB,mBAAmB;AACjD,YAAM,SAAS,iBAAiB,KAAK;AACrC,UAAI,OAAO,KAAM;AAEjB,cAAQ,KAAK,OAAO,KAAK;AAAA,IAC1B;AAEA,UAAM;AAAA,EACP;AACD;AAbiB","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","export function makeIterableIterator<const ElementType>(next: Iterator<ElementType>['next']): IterableIterator<ElementType> {\n\treturn {\n\t\tnext,\n\t\t[Symbol.iterator]() {\n\t\t\treturn this;\n\t\t}\n\t};\n}\n","import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an iterable iterator from an iterable or iterator-like object.\n *\n * @param iterable The iterable or iterable-like object to convert.\n * @returns An iterable iterator.\n *\n * @example\n * ```typescript\n * import { toIterableIterator } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log([...toIterableIterator(array)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log([...toIterableIterator(set)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log([...toIterableIterator(map)]);\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log([...toIterableIterator(string)]);\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n */\nexport function toIterableIterator<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tif (Symbol.iterator in resolvedIterable) {\n\t\treturn resolvedIterable;\n\t}\n\n\treturn makeIterableIterator(() => resolvedIterable.next());\n}\n","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","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","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","export function assertNotNegative(value: number, original: unknown): number {\n\tif (value < 0) {\n\t\tthrow new RangeError(`${original} must be a non-negative number`);\n\t}\n\n\treturn value;\n}\n","export function toNumberOrThrow(value: NumberResolvable): number {\n\tswitch (typeof value) {\n\t\tcase 'bigint':\n\t\t\tthrow new TypeError('Cannot convert a BigInt value to a number');\n\t\tcase 'symbol':\n\t\t\tthrow new TypeError('Cannot convert a Symbol value to a number');\n\t\tcase 'boolean':\n\t\t\treturn value ? 1 : 0;\n\t\tcase 'number':\n\t\t\treturn assertNumber(value, value);\n\t\tcase 'undefined':\n\t\t\tthrow new TypeError('Cannot convert an undefined value to a number');\n\t\tdefault:\n\t\t\treturn assertNumber(Number(value), value);\n\t}\n}\n\nexport type NumberResolvable = number | boolean | null | { valueOf(): number | boolean | null } | { [Symbol.toPrimitive](): number | boolean | null };\n\nfunction assertNumber(value: number, original: unknown): number {\n\tif (Number.isNaN(value)) {\n\t\tthrow new RangeError(`${original} must be a non-NaN number`);\n\t}\n\n\treturn value;\n}\n","import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrInfinityOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) return Number.POSITIVE_INFINITY;\n\tif (number === Number.NEGATIVE_INFINITY) return Number.NEGATIVE_INFINITY;\n\n\treturn Math.trunc(number);\n}\n","import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable by `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of elements to drop from the start of the iteration.\n * @returns An iterator that contains the elements of the provided iterator, except for the first `count` elements.\n *\n * @example\n * ```typescript\n * import { drop } from '@sapphire/iterator-utilities';\n *\n * const iterable = drop(iterator, 2);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n */\nexport function drop<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst resolvedIterable = toIterableIterator(iterable);\n\n\t// If the count is 0, return the original iterable:\n\tif (count === 0) return resolvedIterable;\n\t// If the count is infinite, return an empty iterable:\n\tif (count === Number.POSITIVE_INFINITY) return empty();\n\n\tfor (let i = 0; i < count; i++) {\n\t\tif (resolvedIterable.next().done) break;\n\t}\n\n\treturn resolvedIterable;\n}\n\nexport { drop as skip };\n","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","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","export function assertFunction<Fn extends (...args: any[]) => any>(value: Fn): Fn {\n\tif (typeof value !== 'function') {\n\t\tthrow new TypeError(`${value} must be a function`);\n\t}\n\n\treturn value;\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the results of calling a provided function on each element.\n *\n * @param iterable An iterator to map over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is yielded by the iterator helper.\n *\n * @example\n * ```typescript\n * import { map } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...map(iterable, (value) => value * 2)]);\n * // Output: [2, 4, 6, 8, 10]\n * ```\n */\nexport function* map<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield callbackFn(element, index++);\n\t}\n}\n","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","export function assertPositive(value: number, original: unknown): number {\n\tif (value <= 0) {\n\t\tthrow new RangeError(`${original} must be a positive number`);\n\t}\n\n\treturn value;\n}\n","import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) throw new RangeError('+Infinity cannot be represented as an integer');\n\tif (number === Number.NEGATIVE_INFINITY) throw new RangeError('-Infinity cannot be represented as an integer');\n\n\treturn Math.trunc(number);\n}\n","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","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that pass the test implemented by the provided function.\n *\n * @param iterable The iterator to filter.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to make the element yielded by the iterator helper, and a falsy value otherwise.\n * @returns An iterator that produces elements from the given iterator that satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { filter } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...filter(iterable, (value) => value % 2 === 0)]);\n * // Output: [2, 4]\n * ```\n */\nexport function filter<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<FilteredType>;\nexport function filter<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* filter<ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) yield value;\n\t}\n}\n\nexport { filter as takeWhile };\n","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","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","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","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","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","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","import { empty } from './empty';\nimport { from, type IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Creates an iterable with the first `count` elements.\n *\n * @param iterable The iterator to take values from.\n * @param count The maximum number of values to take from the iterator.\n * @returns An iterator that yields at most `count` values from the provided iterator.\n *\n * @example\n * ```typescript\n * import { take } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...take(iterable, 2)]);\n * // Output: [1, 2]\n * ```\n */\nexport function take<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\n\tlet i = 0;\n\tconst resolvedIterable = from(iterable);\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, resolvedIterable.next())\n\t);\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns an array with all the elements.\n *\n * @param iterable The iterator to convert to an array.\n * @returns An array containing the values of the provided iterator.\n *\n * @example\n * ```typescript\n * import { toArray } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log(toArray(array));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log(toArray(set));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log(toArray(map));\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log(toArray(string));\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function toArray<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType[] {\n\treturn [...toIterableIterator(iterable)];\n}\n","import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable, creating a new iterator without the last `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of values to drop from the end of the iterator.\n * @returns An iterator that contains the elements of the provided iterator, except for the last `count` elements.\n *\n * @example\n * ```typescript\n * import { dropLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropLast([1, 2, 3, 4, 5], 2);\n * console.log([...iterable]);\n * // Output: [1, 2, 3]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function dropLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst array = toArray(iterable);\n\tif (array.length <= count) return empty();\n\treturn take(array.values(), array.length - count);\n}\n\nexport { dropLast as skipLast };\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterator without the elements that satisfy the specified test.\n *\n * @param iterable An iterator to drop values from.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a falsy value to make the element yielded by the iterator helper, and a truthy value otherwise.\n * @returns An iterator that produces elements from the given iterator that don't satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { dropWhile } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropWhile([1, 2, 3, 4, 5], (value) => value < 3);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @seealso {@link filter} or {@link takeWhile} for the opposite behavior.\n */\nexport function dropWhile<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<Exclude<ElementType, FilteredType>>;\nexport function dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) {\n\t\t\tyield value;\n\t\t}\n\t}\n}\n\nexport { dropWhile as skipWhile };\n","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","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","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","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","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","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","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","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\nexport { indexOf as position };\n","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","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","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","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 highest number element. If the iterable is empty, or contains only non-number values, it returns `null`.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @returns The maximum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { max } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(max(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function max(iterable: IterableResolvable<NumberResolvable>): number | null {\n\tlet max: number | null = null;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tif (max === null || value > max) max = value;\n\t}\n\n\treturn max;\n}\n","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 lowest number element. If the iterable is empty, or contains only non-number values, it returns `null`.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @returns The minimum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { min } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(min(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function min(iterable: IterableResolvable<NumberResolvable>): number | null {\n\tlet min: number | null = null;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tif (min === null || value < min) min = value;\n\t}\n\n\treturn min;\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and creates two arrays, one with the elements that pass the test and another with the elements that don't.\n *\n * @param iterable An iterator to partition.\n * @param predicate A function that determines which partition an element belongs to.\n * @returns An array containing two iterators. The first iterator contains elements that satisfy the predicate, and the\n * second iterator contains elements that do not.\n *\n * @example\n * ```typescript\n * import { partition } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [even, odd] = partition(iterable, (value) => value % 2 === 0);\n *\n * console.log(even);\n * // Output: [2, 4]\n *\n * console.log(odd);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into two arrays based on the predicate before returning\n * them, which may not be desirable for large iterators.\n */\nexport function partition<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => value is FilteredType\n): [FilteredType[], Exclude<ElementType, FilteredType>[]];\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]];\n\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]] {\n\tpredicate = assertFunction(predicate);\n\n\tconst bufferLeft: ElementType[] = [];\n\tconst bufferRight: ElementType[] = [];\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (predicate(value, index++)) {\n\t\t\tbufferLeft.push(value);\n\t\t} else {\n\t\t\tbufferRight.push(value);\n\t\t}\n\t}\n\n\treturn [bufferLeft, bufferRight];\n}\n","import { from, type IterableResolvable } from './from';\n\n/**\n * Creates an iterator that allows you to peek at the next element without advancing the iterator.\n *\n * @template ElementType The type of elements in the iterable.\n * @param iterable The iterable to create a peekable iterator from.\n * @returns A new peekable iterator.\n *\n * @example\n * ```typescript\n * import { peekable } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const peekableIterator = peekable(iterable);\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 1, done: false }\n *\n * console.log(peekableIterator.peek());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 3, done: false }\n * ```\n */\nexport function peekable<const ElementType>(iterable: IterableResolvable<ElementType>): Peekable<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tlet peeked: IteratorResult<ElementType> | undefined;\n\treturn {\n\t\tnext() {\n\t\t\tif (peeked) {\n\t\t\t\tconst value = peeked;\n\t\t\t\tpeeked = undefined;\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\treturn resolvedIterable.next();\n\t\t},\n\t\tpeek() {\n\t\t\treturn (peeked ??= resolvedIterable.next());\n\t\t},\n\t\t[Symbol.iterator]() {\n\t\t\treturn this as IterableIterator<ElementType>;\n\t\t}\n\t};\n}\n\nexport interface Peekable<T> extends IterableIterator<T> {\n\tpeek(): IteratorResult<T>;\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterator with the provided iterables prepended to the first iterable.\n *\n * @param iterable The iterator to prepend values to.\n * @param iterables The iterables to prepend to the iterator.\n * @returns An iterator that yields the values of the provided iterator followed by the values of the provided iterables.\n *\n * @example\n * ```typescript\n * import { prepend } from '@sapphire/iterator-utilities';\n *\n * console.log([...prepend([3, 4, 5], [1, 2])]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @seealso {@link append} to append values to the end of an iterator.\n */\nexport function* prepend<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\t...iterables: IterableResolvable<ElementType>[]\n): IterableIterator<ElementType> {\n\tfor (const iterable of iterables) {\n\t\tyield* toIterableIterator(iterable);\n\t}\n\n\tyield* toIterableIterator(iterable);\n}\n","import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the product of all the elements. If the iterable is empty, it returns `1`.\n *\n * @param iterable An iterator to calculate the product of.\n * @returns The product of the elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { product } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(product(iterable));\n * // Output: 120\n *\n * const iterable = [1, 2, 3, 4, 5, 0];\n * console.log(product(iterable));\n * // Output: 0\n * ```\n */\nexport function product(iterable: IterableResolvable<number>): number {\n\tlet result = 1;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tresult *= value;\n\t}\n\n\treturn result;\n}\n","import { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable with the numbers from `start` to `stop` (exclusive) with an optional step.\n *\n * @param start The value of the first number in the range.\n * @param end The end value of the range.\n * @param step The amount to increment the range by.\n *\n * @example\n * ```typescript\n * import { range } from '@sapphire/iterator-utilities';\n *\n * const iterable = range(0, 5);\n * console.log([...iterable]);\n * // Output: [0, 1, 2, 3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(5, 0);\n * console.log([...iterable]);\n * // Output: [5, 4, 3, 2, 1]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(0, 5, 2);\n * console.log([...iterable]);\n * // Output: [0, 2, 4]\n * ```\n */\nexport function* range(start: number, end: number, step?: number | undefined): IterableIterator<number> {\n\tstart = toNumberOrThrow(start);\n\tend = toNumberOrThrow(end);\n\n\tif (step === undefined) {\n\t\tstep = start < end ? 1 : -1;\n\t} else {\n\t\tstep = toNumberOrThrow(step);\n\n\t\t// Prevent infinite loops.\n\t\tif (step === 0) {\n\t\t\tthrow new RangeError('Step cannot be zero');\n\t\t}\n\n\t\t// If the step is positive, the start must be less than the end.\n\t\tif (step > 0 && start > end) {\n\t\t\tthrow new RangeError('Start must be less than end when step is positive');\n\t\t} else if (step < 0 && start < end) {\n\t\t\tthrow new RangeError('Start must be greater than end when step is negative');\n\t\t}\n\t}\n\n\tif (start < end) {\n\t\tfor (let i = start; i < end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t} else {\n\t\tfor (let i = start; i > end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t}\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and reduces it to the reducer function's result.\n *\n * @param iterable An iterator to reduce.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value becomes the value\n * of the `accumulator` parameter on the next invocation of `callbackFn`. For the last invocation, the return value\n * becomes the return value of `reduce()`.\n * @param initialValue A value to which `accumulator` is initialized the first time the callback is called. If\n * `initialValue` is specified, `callbackFn` starts executing with the first element as `currentValue`. If\n * `initialValue` is not specified, `accumulator` is initialized to the first element, and `callbackFn` starts executing\n * with the second element as `currentValue`. In this case, if the iterator is empty (so that there's no first value to\n * return as `accumulator`), an error is thrown.\n * @returns\n *\n * @example\n * ```typescript\n * import { reduce } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(reduce(iterable, (accumulator, currentValue) => accumulator + currentValue));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * If `initialValue` is not provided, the first element of the iterator is used as the initial value of `accumulator`,\n * consuming the first element.\n */\nexport function reduce<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (accumulator: MappedType, currentValue: ElementType, currentIndex: number) => MappedType,\n\tinitialValue?: MappedType\n): MappedType {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index: number;\n\tlet accumulator: MappedType;\n\tconst resolvedIterable = toIterableIterator(iterable);\n\tif (arguments.length < 3) {\n\t\tconst firstValue = resolvedIterable.next();\n\t\tif (firstValue.done) throw new TypeError('Reduce of empty iterator with no initial value');\n\n\t\tindex = 1;\n\t\taccumulator = firstValue.value! as MappedType;\n\t} else {\n\t\tindex = 0;\n\t\taccumulator = initialValue!;\n\t}\n\n\tfor (const value of resolvedIterable) {\n\t\taccumulator = callbackFn(accumulator, value, index++);\n\t}\n\n\treturn accumulator;\n}\n","import { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable that repeats the input iterable `count` times.\n *\n * @param value The value to be repeated.\n * @param count The number of times to repeat the value.\n *\n * @example\n * ```typescript\n * import { repeat } from '@sapphire/iterator-utilities';\n *\n * const iterator = repeat('Hello, world!', 3);\n * console.log([...iterator]);\n * // Output: ['Hello, world!', 'Hello, world!', 'Hello, world!']\n * ```\n *\n * @remarks This function does not clone `value`, it will be repeated as a reference.\n */\nexport function repeat<const ElementType>(value: ElementType, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toNumberOrThrow(count), count);\n\n\tlet i = 0;\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, { done: false, value })\n\t);\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements in reverse order.\n *\n * @param iterable The iterator to reverse.\n * @returns An iterator whose element correspond to the elements of the provided iterator in reverse order.\n *\n * @example\n * ```typescript\n * import { reverse } from '@sapphire/iterator-utilities';\n *\n * console.log([...reverse([1, 2, 3, 4, 5])]);\n * // Output: [5, 4, 3, 2, 1]\n *\n * console.log([...reverse('hello')]);\n * // Output: ['o', 'l', 'l', 'e', 'h']\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into an array before yielding them in reverse order.\n */\nexport function* reverse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst items: ElementType[] = [];\n\tfor (const item of toIterableIterator(iterable)) {\n\t\titems.push(item);\n\t}\n\n\tfor (let i = items.length - 1; i >= 0; i--) {\n\t\tyield items[i];\n\t}\n}\n","import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toArray } from './toArray';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns a new iterable with the last `count` elements.\n *\n * @param iterable An iterator to take values from.\n * @param count The number of values to take from the end of the iterator.\n * @returns An iterator that contains the last `count` elements of the provided iterator.\n *\n * @example\n * ```typescript\n * import { takeLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...takeLast(iterable, 2)]);\n * // Output: [4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function takeLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\tif (count === Number.POSITIVE_INFINITY) return toIterableIterator(iterable);\n\n\tconst array = toArray(iterable);\n\tlet i = Math.max(0, array.length - count);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (i >= array.length) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\treturn { done: false, value: array[i++] };\n\t});\n}\n","import { drop } from './drop';\nimport { dropLast } from './dropLast';\nimport { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { takeLast } from './takeLast';\n\n/**\n * Produces an iterable with the elements from the `start` index to the `end` index (exclusive).\n *\n * @param iterable The iterator to slice.\n * @param start The index at which to begin extraction.\n * @param end The index at which to end extraction.\n * @returns An iterator that contains the elements of the provided iterator from `start` to `end`.\n *\n * @example\n * ```typescript\n * import { slice } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(, 1, 3)]);\n * // Output: [2, 3]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2)]);\n * // Output: [4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2)]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, -1)]);\n * // Output: [3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2, -1)]);\n * // Output: [4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, 1)]);\n * // Output: []\n * ```\n *\n * @remarks\n *\n * This function consumes the input iterator based on the `start` and `end` values, therefore, you should not use the\n * original iterator after calling this function.\n */\nexport function slice<const ElementType>(iterable: IterableResolvable<ElementType>, start?: number, end?: number): IterableIterator<ElementType> {\n\t// https://tc39.es/ecma262/#sec-array.prototype.slice\n\tstart = toIntegerOrInfinityOrThrow(start ?? 0);\n\tif (start === Number.NEGATIVE_INFINITY) {\n\t\tstart = 0;\n\t}\n\n\t// 1. If end is not provided, `slice` behaves like `drop` or `takeLast`,\n\t// depending on the sign of `start`:\n\tif (end === undefined) {\n\t\treturn start >= 0 //\n\t\t\t? drop(iterable, start)\n\t\t\t: takeLast(iterable, -start);\n\t}\n\n\tend = toIntegerOrInfinityOrThrow(end);\n\t// 2. If end is negative:\n\tif (end < 0) {\n\t\t// 2.1. If `end` is `-Infinity`, end would be `0`, which will always\n\t\t// result on an empty iterator:\n\t\tif (end === Number.NEGATIVE_INFINITY) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.2. If start is positive, drop the last n elements:\n\t\tif (start === 0) {\n\t\t\treturn dropLast(iterable, -end);\n\t\t}\n\n\t\t// 2.3. If the start is positive, drop the first n elements and take the\n\t\t// last m elements:\n\t\tif (start >= 0) {\n\t\t\treturn dropLast(drop(iterable, start), -end);\n\t\t}\n\n\t\t// 2.4. If the start is the same or greater than the end, return an\n\t\t// empty iterator:\n\t\tif (start >= end) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.5. `start` and `end` are negative, take the elements between the\n\t\t// start and end:\n\t\treturn take(takeLast(iterable, -start), end - start);\n\t}\n\n\t// 3.0. If `start` is greater than or equal to `end`, return an empty iterator:\n\tif (start >= end) return empty();\n\n\t// 4.0. Otherwise, take the elements between `start` and `end`:\n\treturn end === Number.POSITIVE_INFINITY //\n\t\t? drop(iterable, start)\n\t\t: take(drop(iterable, start), end - start);\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds a matching element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to\n * indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if the callback function returns a truthy value for at least one element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { some } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 2 === 0));\n * // Output: true\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 6 === 0));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function some<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n","import type { IterableResolvable } from './from';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements sorted.\n *\n * @param iterable An iterator to sort.\n * @param compareFn A function that defines the sort order. If omitted, the values are sorted in ascending order.\n * @returns An iterator that yields the values of the provided iterator in sorted order.\n *\n * @example\n * ```typescript\n * import { sorted } from '@sapphire/iterator-utilities';\n *\n * const iterable = [5, 3, 1, 4, 2];\n * console.log([...sorted(iterable)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire input iterator.\n */\nexport function sorted<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcompareFn?: (a: ElementType, b: ElementType) => number\n): IterableIterator<ElementType> {\n\treturn toArray(iterable).sort(compareFn).values();\n}\n","import { type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the results of calling a provided function on each element of the input iterables as the function's parameters.\n *\n * @param iterable The iterable to map over.\n * @param callbackFn The callback function to apply to each element.\n * @returns An iterable iterator that yields the mapped elements.\n *\n * @example\n * ```typescript\n * import { starMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [[1, 2], [3, 4], [5, 6]];\n * console.log([...starMap(iterable, (a, b) => a + b)]);\n * // Output: [3, 7, 11]\n * ```\n *\n * @remarks\n *\n * While very similar to {@link map}, `starMap` takes an iterable of iterables (which can be an array of tuples) and\n * calls the function with each inner iterable's values as the function's parameters. {@link map} calls the function\n * with the value and the index by comparison.\n */\nexport function* starMap<const ElementType extends IterableResolvable<any>, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (...args: StarMapParameters<ElementType>) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield callbackFn(...(toIterableIterator(value) as any));\n\t}\n}\n\nexport type StarMapParameters<ElementType> = ElementType extends readonly [...infer ElementTypeEntry]\n\t? ElementTypeEntry\n\t: ElementType extends IterableResolvable<infer ElementType>\n\t\t? ElementType[]\n\t\t: never;\n","import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow, type NumberResolvable } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the sum of all the elements.\n *\n * @param iterable An iterator of numbers to calculate the sum of.\n * @returns The sum of the numbers in the input iterator.\n *\n * @example\n * ```typescript\n * import { sum } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(sum(iterable));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function sum(iterable: IterableResolvable<NumberResolvable>) {\n\tlet sum = 0;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tsum += value;\n\t}\n\n\treturn sum;\n}\n","import { from, type IterableResolvable } from './from';\nimport { repeat } from './repeat';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrThrow } from './shared/_toIntegerOrThrow';\nimport { toArray } from './toArray';\n\n/**\n * Creates `count` independent iterators from the input iterable.\n *\n * @param iterable An iterator to tee.\n * @param count The number of iterators to create.\n * @returns An array of `count` iterators that each yield the same values as the input iterator.\n *\n * @example\n * ```typescript\n * import { tee } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [iter1, iter2] = tee(iterable, 2);\n * console.log([...iter1]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * console.log([...iter2]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function tee<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType>[] {\n\tcount = assertNotNegative(toIntegerOrThrow(count), count);\n\tif (count === 0) return [];\n\n\tconst entries = [] as ElementType[];\n\tconst indexes = toArray(repeat(0, count));\n\tconst resolvedIterable = from(iterable);\n\n\tconst iterables = [] as IterableIterator<ElementType>[];\n\tfor (let i = 0; i < count; i++) {\n\t\tconst iterable = makeIterableIterator<ElementType>(() => {\n\t\t\tif (indexes[i] >= entries.length) {\n\t\t\t\tconst result = resolvedIterable.next();\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t}\n\n\t\t\t\tentries.push(result.value);\n\t\t\t}\n\n\t\t\treturn { done: false, value: entries[indexes[i]++] };\n\t\t});\n\n\t\titerables.push(iterable);\n\t}\n\n\treturn iterables;\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in either input iterable.\n *\n * @param iterables The iterators to combine.\n * @returns An iterator that yields the union of the provided iterators.\n *\n * @example\n * ```typescript\n * import { union } from '@sapphire/iterator-utilities';\n *\n * const iterable1 = [1, 2, 3];\n * const iterable2 = [3, 4, 5];\n * console.log([...union(iterable1, iterable2)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function* union<const ElementType>(...iterables: IterableResolvable<ElementType>[]): IterableIterator<ElementType> {\n\tconst seen = new Set<ElementType>();\n\tfor (const iterator of iterables) {\n\t\tfor (const value of toIterableIterator(iterator)) {\n\t\t\tif (!seen.has(value)) {\n\t\t\t\tseen.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { IterableResolvable } from './from';\nimport { union } from './union';\n\n/**\n * Creates an iterable with the unique elements of the input iterable. Under the hood, it calls {@linkcode union} with the iterable itself.\n *\n * @param iterable An iterator to remove duplicates from.\n * @returns An iterator that yields the values of the provided iterator with duplicates removed.\n *\n * @example\n * ```typescript\n * import { unique } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5];\n * console.log([...unique(iterable)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function unique<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\t// The union of a single iterator is the iterator itself, with duplicates removed.\n\treturn union(iterable);\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an array for each element of the input iterable, transposing the input iterable. The opposite of {@linkcode zip}.\n *\n * @param iterable An iterable to unzip.\n * @returns An array of iterables that yield the values of the original iterable.\n *\n * @example\n * ```typescript\n * import { unzip } from '@sapphire/iterator-utilities';\n *\n * const iterable = [[1, 'a'], [2, 'b'], [3, 'c']];\n * const [numbers, letters] = unzip(iterable);\n *\n * console.log(numbers);\n * // Output: [1, 2, 3]\n *\n * console.log(letters);\n * // Output: ['a', 'b', 'c']\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterable.\n */\nexport function unzip<const ElementType extends readonly any[]>(iterable: IterableResolvable<ElementType>): UnzipIterable<ElementType> {\n\tconst resolvedIterable = toIterableIterator(iterable);\n\tconst firstResult = resolvedIterable.next();\n\tif (firstResult.done) {\n\t\tthrow new Error('Cannot unzip an empty iterable');\n\t}\n\n\tif (!Array.isArray(firstResult.value)) {\n\t\tthrow new Error('Cannot unzip an iterable that does not yield an array');\n\t}\n\n\tconst size = firstResult.value.length;\n\tconst results = [] as ElementType[][];\n\tfor (let i = 0; i < size; i++) results.push([firstResult.value[i]]);\n\tfor (const entries of resolvedIterable) {\n\t\tif (!Array.isArray(entries)) {\n\t\t\tthrow new Error('Cannot unzip an iterable that does not yield an array');\n\t\t}\n\n\t\tif (entries.length !== size) {\n\t\t\tthrow new Error('Cannot unzip an iterable that yields arrays of different sizes');\n\t\t}\n\n\t\tfor (let i = 0; i < size; i++) {\n\t\t\tresults[i].push(entries[i]);\n\t\t}\n\t}\n\n\treturn results as UnzipIterable<ElementType>;\n}\n\nexport type UnzipIterable<ElementType extends readonly any[]> = {\n\t-readonly [P in keyof ElementType]: ElementType[P][];\n};\n","import { from, type IterableResolvable } from './from';\n\n/**\n * Creates an iterable with the elements of the input iterables zipped together. The opposite of {@linkcode unzip}.\n *\n * @param iterables The iterables to zip together.\n * @returns A new iterable that yields the next value of each iterable in the list.\n *\n * @example\n * ```typescript\n * import { zip } from '@sapphire/iterator-utilities';\n *\n * const iterable1 = [1, 2, 3];\n * const iterable2 = ['a', 'b', 'c'];\n * const iterable3 = [true, false, true];\n *\n * console.log(zip(iterable1, iterable2, iterable3));\n * // Output: [\n * // \t[1, 'a', true],\n * // \t[2, 'b', false],\n * // \t[3, 'c', true]\n * // ]\n * ```\n */\nexport function* zip<const Iterables extends readonly IterableResolvable<any>[]>(...iterables: Iterables): ZipIterators<Iterables> {\n\tconst resolvedIterables = iterables.map((iterable) => from(iterable));\n\twhile (true) {\n\t\tconst results = [] as any[];\n\t\tfor (const resolvedIterable of resolvedIterables) {\n\t\t\tconst result = resolvedIterable.next();\n\t\t\tif (result.done) return;\n\n\t\t\tresults.push(result.value);\n\t\t}\n\n\t\tyield results as any;\n\t}\n}\n\nexport type ZipIterators<Iterators extends readonly IterableResolvable<any>[]> = IterableIterator<{\n\t-readonly [P in keyof Iterators]: Iterators[P] extends IterableResolvable<infer T> ? T : never;\n}>;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/from.ts","../../src/lib/shared/_makeIterableIterator.ts","../../src/lib/toIterableIterator.ts","../../src/lib/chain.ts","../../src/lib/append.ts","../../src/lib/empty.ts","../../src/lib/shared/_assertNotNegative.ts","../../src/lib/shared/_toNumberOrThrow.ts","../../src/lib/shared/_toIntegerOrInfinityOrThrow.ts","../../src/lib/drop.ts","../../src/lib/first.ts","../../src/lib/at.ts","../../src/lib/shared/_assertFunction.ts","../../src/lib/map.ts","../../src/lib/average.ts","../../src/lib/shared/_assertPositive.ts","../../src/lib/shared/_toIntegerOrThrow.ts","../../src/lib/chunk.ts","../../src/lib/filter.ts","../../src/lib/compact.ts","../../src/lib/compress.ts","../../src/lib/contains.ts","../../src/lib/count.ts","../../src/lib/cycle.ts","../../src/lib/difference.ts","../../src/lib/take.ts","../../src/lib/toArray.ts","../../src/lib/dropLast.ts","../../src/lib/dropWhile.ts","../../src/lib/enumerate.ts","../../src/lib/every.ts","../../src/lib/find.ts","../../src/lib/findIndex.ts","../../src/lib/flat.ts","../../src/lib/flatMap.ts","../../src/lib/forEach.ts","../../src/lib/indexOf.ts","../../src/lib/intersect.ts","../../src/lib/isEmpty.ts","../../src/lib/last.ts","../../src/lib/max.ts","../../src/lib/min.ts","../../src/lib/partition.ts","../../src/lib/peekable.ts","../../src/lib/prepend.ts","../../src/lib/product.ts","../../src/lib/range.ts","../../src/lib/reduce.ts","../../src/lib/repeat.ts","../../src/lib/reverse.ts","../../src/lib/takeLast.ts","../../src/lib/slice.ts","../../src/lib/some.ts","../../src/lib/sorted.ts","../../src/lib/starMap.ts","../../src/lib/sum.ts","../../src/lib/tee.ts","../../src/lib/union.ts","../../src/lib/unique.ts","../../src/lib/unzip.ts","../../src/lib/zip.ts"],"names":["count","sum","first","last","max","min","iterable"],"mappings":";;;;;;;EAmBO,SAAS,KAAK,KAAY,EAAA;EAChC,EAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,KAAA,KAAU,IAAM,EAAA;EAChD,IAAA,IAAI,OAAO,KAAA,CAAM,MAAO,CAAA,QAAQ,MAAM,UAAY,EAAA;EACjD,MAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA,CAAA;EAAA,KAC/B;EAEA,IAAI,IAAA,OAAO,KAAM,CAAA,IAAA,KAAS,UAAY,EAAA;EACrC,MAAO,OAAA,KAAA,CAAA;EAAA,KACR;EAAA,GACD;EAEA,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;EAC9B,IAAO,OAAA,KAAA,CAAM,MAAO,CAAA,QAAQ,CAAE,EAAA,CAAA;EAAA,GAC/B;EAEA,EAAA,MAAM,IAAI,SAAU,CAAA,CAAA,EAAG,MAAO,CAAA,KAAK,CAAC,CAAqC,mCAAA,CAAA,CAAA,CAAA;EAC1E,CAAA;EAhBgB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA,CAAA;;;ECnBT,SAAS,qBAAwC,IAAoE,EAAA;EAC3H,EAAO,OAAA;EAAA,IACN,IAAA;EAAA,IACA,CAAC,MAAO,CAAA,QAAQ,CAAI,GAAA;EACnB,MAAO,OAAA,IAAA,CAAA;EAAA,KACR;EAAA,GACD,CAAA;EACD,CAAA;EAPgB,MAAA,CAAA,oBAAA,EAAA,sBAAA,CAAA,CAAA;;;EC8BT,SAAS,mBAAsC,QAA0E,EAAA;EAC/H,EAAM,MAAA,gBAAA,GAAmB,KAAK,QAAQ,CAAA,CAAA;EACtC,EAAI,IAAA,MAAA,CAAO,YAAY,gBAAkB,EAAA;EACxC,IA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CAAC,CAAC,CAAA,CAAA;EAAA,KAC3B;EAAA,GACD;EAEA,EAAO,OAAA,OAAA,CAAA;EACR,CAAA;EA7BgB,MAAA,CAAA,KAAA,EAAA,OAAA,CAAA,CAAA;;;ECHT,UAAU,OAAmE,SAA+C,EAAA;EAClI,EAAA,MAAM,oBAAoB,SAAU,CAAA,GAAA,CAAI,CAAC,QAAa,KAAA,IAAA,CAAK,QAAQ,CAAC,CAAA,CAAA;EACpE,EAAA,OAAO,IAAM,EAAA;EACZ,IAAA,MAAM,UAAU,EAAC,CAAA;EACjB,IAAA,KAAA,MAAW,oBAAoB,iBAAmB,EAAA;EACjD,MAAM,MAAA,MAAA,GAAS,iBAAiB,IAAK,EAAA,CAAA;EACrC,MAAA,IAAI,OAAO,IAAM,EAAA,OAAA;EAEjB,MAAQ,OAAA,CAAA,IAAA,CAAK,OAAO,KAAK,CAAA,CAAA;EAAA,KAC1B;EAEA,IAAM,MAAA,OAAA,CAAA;EAAA,GACP;EACD,CAAA;EAbiB,MAAA,CAAA,GAAA,EAAA,KAAA,CAAA","file":"index.global.js","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","export function makeIterableIterator<const ElementType>(next: Iterator<ElementType>['next']): IterableIterator<ElementType> {\n\treturn {\n\t\tnext,\n\t\t[Symbol.iterator]() {\n\t\t\treturn this;\n\t\t}\n\t};\n}\n","import { from, type IterableResolvable } from './from';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\n\n/**\n * Creates an iterable iterator from an iterable or iterator-like object.\n *\n * @param iterable The iterable or iterable-like object to convert.\n * @returns An iterable iterator.\n *\n * @example\n * ```typescript\n * import { toIterableIterator } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log([...toIterableIterator(array)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log([...toIterableIterator(set)]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log([...toIterableIterator(map)]);\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log([...toIterableIterator(string)]);\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n */\nexport function toIterableIterator<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tif (Symbol.iterator in resolvedIterable) {\n\t\treturn resolvedIterable;\n\t}\n\n\treturn makeIterableIterator(() => resolvedIterable.next());\n}\n","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","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","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","export function assertNotNegative(value: number, original: unknown): number {\n\tif (value < 0) {\n\t\tthrow new RangeError(`${original} must be a non-negative number`);\n\t}\n\n\treturn value;\n}\n","export function toNumberOrThrow(value: NumberResolvable): number {\n\tswitch (typeof value) {\n\t\tcase 'bigint':\n\t\t\tthrow new TypeError('Cannot convert a BigInt value to a number');\n\t\tcase 'symbol':\n\t\t\tthrow new TypeError('Cannot convert a Symbol value to a number');\n\t\tcase 'boolean':\n\t\t\treturn value ? 1 : 0;\n\t\tcase 'number':\n\t\t\treturn assertNumber(value, value);\n\t\tcase 'undefined':\n\t\t\tthrow new TypeError('Cannot convert an undefined value to a number');\n\t\tdefault:\n\t\t\treturn assertNumber(Number(value), value);\n\t}\n}\n\nexport type NumberResolvable = number | boolean | null | { valueOf(): number | boolean | null } | { [Symbol.toPrimitive](): number | boolean | null };\n\nfunction assertNumber(value: number, original: unknown): number {\n\tif (Number.isNaN(value)) {\n\t\tthrow new RangeError(`${original} must be a non-NaN number`);\n\t}\n\n\treturn value;\n}\n","import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrInfinityOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) return Number.POSITIVE_INFINITY;\n\tif (number === Number.NEGATIVE_INFINITY) return Number.NEGATIVE_INFINITY;\n\n\treturn Math.trunc(number);\n}\n","import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable by `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of elements to drop from the start of the iteration.\n * @returns An iterator that contains the elements of the provided iterator, except for the first `count` elements.\n *\n * @example\n * ```typescript\n * import { drop } from '@sapphire/iterator-utilities';\n *\n * const iterable = drop(iterator, 2);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n */\nexport function drop<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst resolvedIterable = toIterableIterator(iterable);\n\n\t// If the count is 0, return the original iterable:\n\tif (count === 0) return resolvedIterable;\n\t// If the count is infinite, return an empty iterable:\n\tif (count === Number.POSITIVE_INFINITY) return empty();\n\n\tfor (let i = 0; i < count; i++) {\n\t\tif (resolvedIterable.next().done) break;\n\t}\n\n\treturn resolvedIterable;\n}\n\nexport { drop as skip };\n","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","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","export function assertFunction<Fn extends (...args: any[]) => any>(value: Fn): Fn {\n\tif (typeof value !== 'function') {\n\t\tthrow new TypeError(`${value} must be a function`);\n\t}\n\n\treturn value;\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the results of calling a provided function on each element.\n *\n * @param iterable An iterator to map over.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value is yielded by the iterator helper.\n *\n * @example\n * ```typescript\n * import { map } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...map(iterable, (value) => value * 2)]);\n * // Output: [2, 4, 6, 8, 10]\n * ```\n */\nexport function* map<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const element of toIterableIterator(iterable)) {\n\t\tyield callbackFn(element, index++);\n\t}\n}\n","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","export function assertPositive(value: number, original: unknown): number {\n\tif (value <= 0) {\n\t\tthrow new RangeError(`${original} must be a positive number`);\n\t}\n\n\treturn value;\n}\n","import { toNumberOrThrow } from './_toNumberOrThrow';\n\nexport function toIntegerOrThrow(value: number): number {\n\tconst number = toNumberOrThrow(value);\n\tif (Number.isNaN(number) || number === 0) return 0;\n\tif (number === Number.POSITIVE_INFINITY) throw new RangeError('+Infinity cannot be represented as an integer');\n\tif (number === Number.NEGATIVE_INFINITY) throw new RangeError('-Infinity cannot be represented as an integer');\n\n\treturn Math.trunc(number);\n}\n","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","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that pass the test implemented by the provided function.\n *\n * @param iterable The iterator to filter.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to make the element yielded by the iterator helper, and a falsy value otherwise.\n * @returns An iterator that produces elements from the given iterator that satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { filter } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...filter(iterable, (value) => value % 2 === 0)]);\n * // Output: [2, 4]\n * ```\n */\nexport function filter<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<FilteredType>;\nexport function filter<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* filter<ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) yield value;\n\t}\n}\n\nexport { filter as takeWhile };\n","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","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","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","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","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","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","import { empty } from './empty';\nimport { from, type IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\n\n/**\n * Creates an iterable with the first `count` elements.\n *\n * @param iterable The iterator to take values from.\n * @param count The maximum number of values to take from the iterator.\n * @returns An iterator that yields at most `count` values from the provided iterator.\n *\n * @example\n * ```typescript\n * import { take } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...take(iterable, 2)]);\n * // Output: [1, 2]\n * ```\n */\nexport function take<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\n\tlet i = 0;\n\tconst resolvedIterable = from(iterable);\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, resolvedIterable.next())\n\t);\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns an array with all the elements.\n *\n * @param iterable The iterator to convert to an array.\n * @returns An array containing the values of the provided iterator.\n *\n * @example\n * ```typescript\n * import { toArray } from '@sapphire/iterator-utilities';\n *\n * const array = [1, 2, 3, 4, 5];\n * console.log(toArray(array));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const set = new Set([1, 2, 3, 4, 5]);\n * console.log(toArray(set));\n * // Output: [1, 2, 3, 4, 5]\n *\n * const map = new Map([['a', 1], ['b', 2], ['c', 3]]);\n * console.log(toArray(map));\n * // Output: [['a', 1], ['b', 2], ['c', 3]]\n *\n * const string = 'hello';\n * console.log(toArray(string));\n * // Output: ['h', 'e', 'l', 'l', 'o']\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function toArray<const ElementType>(iterable: IterableResolvable<ElementType>): ElementType[] {\n\treturn [...toIterableIterator(iterable)];\n}\n","import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable, creating a new iterator without the last `count` elements from the iterable.\n *\n * @param iterable An iterator to drop values from.\n * @param count The number of values to drop from the end of the iterator.\n * @returns An iterator that contains the elements of the provided iterator, except for the last `count` elements.\n *\n * @example\n * ```typescript\n * import { dropLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropLast([1, 2, 3, 4, 5], 2);\n * console.log([...iterable]);\n * // Output: [1, 2, 3]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function dropLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tconst array = toArray(iterable);\n\tif (array.length <= count) return empty();\n\treturn take(array.values(), array.length - count);\n}\n\nexport { dropLast as skipLast };\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates a new iterator without the elements that satisfy the specified test.\n *\n * @param iterable An iterator to drop values from.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a falsy value to make the element yielded by the iterator helper, and a truthy value otherwise.\n * @returns An iterator that produces elements from the given iterator that don't satisfy the specified test.\n *\n * @example\n * ```typescript\n * import { dropWhile } from '@sapphire/iterator-utilities';\n *\n * const iterable = dropWhile([1, 2, 3, 4, 5], (value) => value < 3);\n * console.log([...iterable]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @seealso {@link filter} or {@link takeWhile} for the opposite behavior.\n */\nexport function dropWhile<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => element is FilteredType\n): IterableIterator<Exclude<ElementType, FilteredType>>;\nexport function dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType>;\nexport function* dropWhile<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): IterableIterator<ElementType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (!callbackFn(value, index++)) {\n\t\t\tyield value;\n\t\t}\n\t}\n}\n\nexport { dropWhile as skipWhile };\n","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","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","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","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","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","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","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","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\nexport { indexOf as position };\n","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","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","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","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 highest number element. If the iterable is empty, or contains only non-number values, it returns `null`.\n *\n * @param iterable An iterator of number values to determine the maximum value of.\n * @returns The maximum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { max } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(max(iterable));\n * // Output: 5\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function max(iterable: IterableResolvable<NumberResolvable>): number | null {\n\tlet max: number | null = null;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tif (max === null || value > max) max = value;\n\t}\n\n\treturn max;\n}\n","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 lowest number element. If the iterable is empty, or contains only non-number values, it returns `null`.\n *\n * @param iterable An iterator of number values to determine the minimum value of.\n * @returns The minimum value in the input iterator, or `null` if the iterator is empty or contains only non-number values.\n *\n * @example\n * ```typescript\n * import { min } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(min(iterable));\n * // Output: 1\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function min(iterable: IterableResolvable<NumberResolvable>): number | null {\n\tlet min: number | null = null;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tif (min === null || value < min) min = value;\n\t}\n\n\treturn min;\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and creates two arrays, one with the elements that pass the test and another with the elements that don't.\n *\n * @param iterable An iterator to partition.\n * @param predicate A function that determines which partition an element belongs to.\n * @returns An array containing two iterators. The first iterator contains elements that satisfy the predicate, and the\n * second iterator contains elements that do not.\n *\n * @example\n * ```typescript\n * import { partition } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [even, odd] = partition(iterable, (value) => value % 2 === 0);\n *\n * console.log(even);\n * // Output: [2, 4]\n *\n * console.log(odd);\n * // Output: [1, 3, 5]\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into two arrays based on the predicate before returning\n * them, which may not be desirable for large iterators.\n */\nexport function partition<const ElementType, const FilteredType extends ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => value is FilteredType\n): [FilteredType[], Exclude<ElementType, FilteredType>[]];\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]];\n\nexport function partition<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tpredicate: (value: ElementType, index: number) => boolean\n): [ElementType[], ElementType[]] {\n\tpredicate = assertFunction(predicate);\n\n\tconst bufferLeft: ElementType[] = [];\n\tconst bufferRight: ElementType[] = [];\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (predicate(value, index++)) {\n\t\t\tbufferLeft.push(value);\n\t\t} else {\n\t\t\tbufferRight.push(value);\n\t\t}\n\t}\n\n\treturn [bufferLeft, bufferRight];\n}\n","import { from, type IterableResolvable } from './from';\n\n/**\n * Creates an iterator that allows you to peek at the next element without advancing the iterator.\n *\n * @template ElementType The type of elements in the iterable.\n * @param iterable The iterable to create a peekable iterator from.\n * @returns A new peekable iterator.\n *\n * @example\n * ```typescript\n * import { peekable } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const peekableIterator = peekable(iterable);\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 1, done: false }\n *\n * console.log(peekableIterator.peek());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 2, done: false }\n *\n * console.log(peekableIterator.next());\n * // Output: { value: 3, done: false }\n * ```\n */\nexport function peekable<const ElementType>(iterable: IterableResolvable<ElementType>): Peekable<ElementType> {\n\tconst resolvedIterable = from(iterable);\n\tlet peeked: IteratorResult<ElementType> | undefined;\n\treturn {\n\t\tnext() {\n\t\t\tif (peeked) {\n\t\t\t\tconst value = peeked;\n\t\t\t\tpeeked = undefined;\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t\treturn resolvedIterable.next();\n\t\t},\n\t\tpeek() {\n\t\t\treturn (peeked ??= resolvedIterable.next());\n\t\t},\n\t\t[Symbol.iterator]() {\n\t\t\treturn this as IterableIterator<ElementType>;\n\t\t}\n\t};\n}\n\nexport interface Peekable<T> extends IterableIterator<T> {\n\tpeek(): IteratorResult<T>;\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterator with the provided iterables prepended to the first iterable.\n *\n * @param iterable The iterator to prepend values to.\n * @param iterables The iterables to prepend to the iterator.\n * @returns An iterator that yields the values of the provided iterator followed by the values of the provided iterables.\n *\n * @example\n * ```typescript\n * import { prepend } from '@sapphire/iterator-utilities';\n *\n * console.log([...prepend([3, 4, 5], [1, 2])]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @seealso {@link append} to append values to the end of an iterator.\n */\nexport function* prepend<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\t...iterables: IterableResolvable<ElementType>[]\n): IterableIterator<ElementType> {\n\tfor (const iterable of iterables) {\n\t\tyield* toIterableIterator(iterable);\n\t}\n\n\tyield* toIterableIterator(iterable);\n}\n","import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the product of all the elements. If the iterable is empty, it returns `1`.\n *\n * @param iterable An iterator to calculate the product of.\n * @returns The product of the elements in the input iterator.\n *\n * @example\n * ```typescript\n * import { product } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(product(iterable));\n * // Output: 120\n *\n * const iterable = [1, 2, 3, 4, 5, 0];\n * console.log(product(iterable));\n * // Output: 0\n * ```\n */\nexport function product(iterable: IterableResolvable<number>): number {\n\tlet result = 1;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tresult *= value;\n\t}\n\n\treturn result;\n}\n","import { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable with the numbers from `start` to `stop` (exclusive) with an optional step.\n *\n * @param start The value of the first number in the range.\n * @param end The end value of the range.\n * @param step The amount to increment the range by.\n *\n * @example\n * ```typescript\n * import { range } from '@sapphire/iterator-utilities';\n *\n * const iterable = range(0, 5);\n * console.log([...iterable]);\n * // Output: [0, 1, 2, 3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(5, 0);\n * console.log([...iterable]);\n * // Output: [5, 4, 3, 2, 1]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = range(0, 5, 2);\n * console.log([...iterable]);\n * // Output: [0, 2, 4]\n * ```\n */\nexport function* range(start: number, end: number, step?: number | undefined): IterableIterator<number> {\n\tstart = toNumberOrThrow(start);\n\tend = toNumberOrThrow(end);\n\n\tif (step === undefined) {\n\t\tstep = start < end ? 1 : -1;\n\t} else {\n\t\tstep = toNumberOrThrow(step);\n\n\t\t// Prevent infinite loops.\n\t\tif (step === 0) {\n\t\t\tthrow new RangeError('Step cannot be zero');\n\t\t}\n\n\t\t// If the step is positive, the start must be less than the end.\n\t\tif (step > 0 && start > end) {\n\t\t\tthrow new RangeError('Start must be less than end when step is positive');\n\t\t} else if (step < 0 && start < end) {\n\t\t\tthrow new RangeError('Start must be greater than end when step is negative');\n\t\t}\n\t}\n\n\tif (start < end) {\n\t\tfor (let i = start; i < end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t} else {\n\t\tfor (let i = start; i > end; i += step) {\n\t\t\tyield i;\n\t\t}\n\t}\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and reduces it to the reducer function's result.\n *\n * @param iterable An iterator to reduce.\n * @param callbackFn A function to execute for each element produced by the iterator. Its return value becomes the value\n * of the `accumulator` parameter on the next invocation of `callbackFn`. For the last invocation, the return value\n * becomes the return value of `reduce()`.\n * @param initialValue A value to which `accumulator` is initialized the first time the callback is called. If\n * `initialValue` is specified, `callbackFn` starts executing with the first element as `currentValue`. If\n * `initialValue` is not specified, `accumulator` is initialized to the first element, and `callbackFn` starts executing\n * with the second element as `currentValue`. In this case, if the iterator is empty (so that there's no first value to\n * return as `accumulator`), an error is thrown.\n * @returns\n *\n * @example\n * ```typescript\n * import { reduce } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(reduce(iterable, (accumulator, currentValue) => accumulator + currentValue));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * If `initialValue` is not provided, the first element of the iterator is used as the initial value of `accumulator`,\n * consuming the first element.\n */\nexport function reduce<const ElementType, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (accumulator: MappedType, currentValue: ElementType, currentIndex: number) => MappedType,\n\tinitialValue?: MappedType\n): MappedType {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index: number;\n\tlet accumulator: MappedType;\n\tconst resolvedIterable = toIterableIterator(iterable);\n\tif (arguments.length < 3) {\n\t\tconst firstValue = resolvedIterable.next();\n\t\tif (firstValue.done) throw new TypeError('Reduce of empty iterator with no initial value');\n\n\t\tindex = 1;\n\t\taccumulator = firstValue.value! as MappedType;\n\t} else {\n\t\tindex = 0;\n\t\taccumulator = initialValue!;\n\t}\n\n\tfor (const value of resolvedIterable) {\n\t\taccumulator = callbackFn(accumulator, value, index++);\n\t}\n\n\treturn accumulator;\n}\n","import { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toNumberOrThrow } from './shared/_toNumberOrThrow';\n\n/**\n * Creates an iterable that repeats the input iterable `count` times.\n *\n * @param value The value to be repeated.\n * @param count The number of times to repeat the value.\n *\n * @example\n * ```typescript\n * import { repeat } from '@sapphire/iterator-utilities';\n *\n * const iterator = repeat('Hello, world!', 3);\n * console.log([...iterator]);\n * // Output: ['Hello, world!', 'Hello, world!', 'Hello, world!']\n * ```\n *\n * @remarks This function does not clone `value`, it will be repeated as a reference.\n */\nexport function repeat<const ElementType>(value: ElementType, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toNumberOrThrow(count), count);\n\n\tlet i = 0;\n\treturn makeIterableIterator<ElementType>(() =>\n\t\ti >= count //\n\t\t\t? { done: true, value: undefined }\n\t\t\t: (i++, { done: false, value })\n\t);\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements in reverse order.\n *\n * @param iterable The iterator to reverse.\n * @returns An iterator whose element correspond to the elements of the provided iterator in reverse order.\n *\n * @example\n * ```typescript\n * import { reverse } from '@sapphire/iterator-utilities';\n *\n * console.log([...reverse([1, 2, 3, 4, 5])]);\n * // Output: [5, 4, 3, 2, 1]\n *\n * console.log([...reverse('hello')]);\n * // Output: ['o', 'l', 'l', 'e', 'h']\n * ```\n *\n * @remarks\n *\n * This function collects all elements of the provided iterator into an array before yielding them in reverse order.\n */\nexport function* reverse<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\tconst items: ElementType[] = [];\n\tfor (const item of toIterableIterator(iterable)) {\n\t\titems.push(item);\n\t}\n\n\tfor (let i = items.length - 1; i >= 0; i--) {\n\t\tyield items[i];\n\t}\n}\n","import { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { toArray } from './toArray';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Consumes the iterable and returns a new iterable with the last `count` elements.\n *\n * @param iterable An iterator to take values from.\n * @param count The number of values to take from the end of the iterator.\n * @returns An iterator that contains the last `count` elements of the provided iterator.\n *\n * @example\n * ```typescript\n * import { takeLast } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...takeLast(iterable, 2)]);\n * // Output: [4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function takeLast<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType> {\n\tcount = assertNotNegative(toIntegerOrInfinityOrThrow(count), count);\n\tif (count === 0) return empty();\n\tif (count === Number.POSITIVE_INFINITY) return toIterableIterator(iterable);\n\n\tconst array = toArray(iterable);\n\tlet i = Math.max(0, array.length - count);\n\treturn makeIterableIterator<ElementType>(() => {\n\t\tif (i >= array.length) {\n\t\t\treturn { done: true, value: undefined };\n\t\t}\n\n\t\treturn { done: false, value: array[i++] };\n\t});\n}\n","import { drop } from './drop';\nimport { dropLast } from './dropLast';\nimport { empty } from './empty';\nimport type { IterableResolvable } from './from';\nimport { toIntegerOrInfinityOrThrow } from './shared/_toIntegerOrInfinityOrThrow';\nimport { take } from './take';\nimport { takeLast } from './takeLast';\n\n/**\n * Produces an iterable with the elements from the `start` index to the `end` index (exclusive).\n *\n * @param iterable The iterator to slice.\n * @param start The index at which to begin extraction.\n * @param end The index at which to end extraction.\n * @returns An iterator that contains the elements of the provided iterator from `start` to `end`.\n *\n * @example\n * ```typescript\n * import { slice } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(, 1, 3)]);\n * // Output: [2, 3]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2)]);\n * // Output: [4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2)]);\n * // Output: [3, 4, 5]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, -1)]);\n * // Output: [3, 4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, -2, -1)]);\n * // Output: [4]\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log([...slice(iterable, 2, 1)]);\n * // Output: []\n * ```\n *\n * @remarks\n *\n * This function consumes the input iterator based on the `start` and `end` values, therefore, you should not use the\n * original iterator after calling this function.\n */\nexport function slice<const ElementType>(iterable: IterableResolvable<ElementType>, start?: number, end?: number): IterableIterator<ElementType> {\n\t// https://tc39.es/ecma262/#sec-array.prototype.slice\n\tstart = toIntegerOrInfinityOrThrow(start ?? 0);\n\tif (start === Number.NEGATIVE_INFINITY) {\n\t\tstart = 0;\n\t}\n\n\t// 1. If end is not provided, `slice` behaves like `drop` or `takeLast`,\n\t// depending on the sign of `start`:\n\tif (end === undefined) {\n\t\treturn start >= 0 //\n\t\t\t? drop(iterable, start)\n\t\t\t: takeLast(iterable, -start);\n\t}\n\n\tend = toIntegerOrInfinityOrThrow(end);\n\t// 2. If end is negative:\n\tif (end < 0) {\n\t\t// 2.1. If `end` is `-Infinity`, end would be `0`, which will always\n\t\t// result on an empty iterator:\n\t\tif (end === Number.NEGATIVE_INFINITY) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.2. If start is positive, drop the last n elements:\n\t\tif (start === 0) {\n\t\t\treturn dropLast(iterable, -end);\n\t\t}\n\n\t\t// 2.3. If the start is positive, drop the first n elements and take the\n\t\t// last m elements:\n\t\tif (start >= 0) {\n\t\t\treturn dropLast(drop(iterable, start), -end);\n\t\t}\n\n\t\t// 2.4. If the start is the same or greater than the end, return an\n\t\t// empty iterator:\n\t\tif (start >= end) {\n\t\t\treturn empty();\n\t\t}\n\n\t\t// 2.5. `start` and `end` are negative, take the elements between the\n\t\t// start and end:\n\t\treturn take(takeLast(iterable, -start), end - start);\n\t}\n\n\t// 3.0. If `start` is greater than or equal to `end`, return an empty iterator:\n\tif (start >= end) return empty();\n\n\t// 4.0. Otherwise, take the elements between `start` and `end`:\n\treturn end === Number.POSITIVE_INFINITY //\n\t\t? drop(iterable, start)\n\t\t: take(drop(iterable, start), end - start);\n}\n","import type { IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Advances the iterable until it finds a matching element, returning `true` if it's found and `false` otherwise.\n *\n * @param iterable An iterator to search for a value in.\n * @param callbackFn A function to execute for each element produced by the iterator. It should return a truthy value to\n * indicate the element passes the test, and a falsy value otherwise.\n * @returns `true` if the callback function returns a truthy value for at least one element. Otherwise, `false`.\n *\n * @example\n * ```typescript\n * import { some } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 2 === 0));\n * // Output: true\n * ```\n *\n * @example\n * ```typescript\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(some(iterable, (value) => value % 6 === 0));\n * // Output: false\n * ```\n *\n * @remarks\n *\n * This function consumes the iterator until the value is found or the iterator is exhausted.\n */\nexport function some<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (element: ElementType, index: number) => boolean\n): boolean {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tlet index = 0;\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tif (callbackFn(value, index++)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\n\treturn false;\n}\n","import type { IterableResolvable } from './from';\nimport { toArray } from './toArray';\n\n/**\n * Consumes the iterable and returns a new iterable with the elements sorted.\n *\n * @param iterable An iterator to sort.\n * @param compareFn A function that defines the sort order. If omitted, the values are sorted in ascending order.\n * @returns An iterator that yields the values of the provided iterator in sorted order.\n *\n * @example\n * ```typescript\n * import { sorted } from '@sapphire/iterator-utilities';\n *\n * const iterable = [5, 3, 1, 4, 2];\n * console.log([...sorted(iterable)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n *\n * @remarks\n *\n * This function consumes the entire input iterator.\n */\nexport function sorted<const ElementType>(\n\titerable: IterableResolvable<ElementType>,\n\tcompareFn?: (a: ElementType, b: ElementType) => number\n): IterableIterator<ElementType> {\n\treturn toArray(iterable).sort(compareFn).values();\n}\n","import { type IterableResolvable } from './from';\nimport { assertFunction } from './shared/_assertFunction';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the results of calling a provided function on each element of the input iterables as the function's parameters.\n *\n * @param iterable The iterable to map over.\n * @param callbackFn The callback function to apply to each element.\n * @returns An iterable iterator that yields the mapped elements.\n *\n * @example\n * ```typescript\n * import { starMap } from '@sapphire/iterator-utilities';\n *\n * const iterable = [[1, 2], [3, 4], [5, 6]];\n * console.log([...starMap(iterable, (a, b) => a + b)]);\n * // Output: [3, 7, 11]\n * ```\n *\n * @remarks\n *\n * While very similar to {@link map}, `starMap` takes an iterable of iterables (which can be an array of tuples) and\n * calls the function with each inner iterable's values as the function's parameters. {@link map} calls the function\n * with the value and the index by comparison.\n */\nexport function* starMap<const ElementType extends IterableResolvable<any>, const MappedType>(\n\titerable: IterableResolvable<ElementType>,\n\tcallbackFn: (...args: StarMapParameters<ElementType>) => MappedType\n): IterableIterator<MappedType> {\n\tcallbackFn = assertFunction(callbackFn);\n\n\tfor (const value of toIterableIterator(iterable)) {\n\t\tyield callbackFn(...(toIterableIterator(value) as any));\n\t}\n}\n\nexport type StarMapParameters<ElementType> = ElementType extends readonly [...infer ElementTypeEntry]\n\t? ElementTypeEntry\n\t: ElementType extends IterableResolvable<infer ElementType>\n\t\t? ElementType[]\n\t\t: never;\n","import type { IterableResolvable } from './from';\nimport { map } from './map';\nimport { toNumberOrThrow, type NumberResolvable } from './shared/_toNumberOrThrow';\n\n/**\n * Consumes the iterable and returns the sum of all the elements.\n *\n * @param iterable An iterator of numbers to calculate the sum of.\n * @returns The sum of the numbers in the input iterator.\n *\n * @example\n * ```typescript\n * import { sum } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * console.log(sum(iterable));\n * // Output: 15\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterator.\n */\nexport function sum(iterable: IterableResolvable<NumberResolvable>) {\n\tlet sum = 0;\n\tfor (const value of map(iterable, toNumberOrThrow)) {\n\t\tsum += value;\n\t}\n\n\treturn sum;\n}\n","import { from, type IterableResolvable } from './from';\nimport { repeat } from './repeat';\nimport { assertNotNegative } from './shared/_assertNotNegative';\nimport { makeIterableIterator } from './shared/_makeIterableIterator';\nimport { toIntegerOrThrow } from './shared/_toIntegerOrThrow';\nimport { toArray } from './toArray';\n\n/**\n * Creates `count` independent iterators from the input iterable.\n *\n * @param iterable An iterator to tee.\n * @param count The number of iterators to create.\n * @returns An array of `count` iterators that each yield the same values as the input iterator.\n *\n * @example\n * ```typescript\n * import { tee } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 3, 4, 5];\n * const [iter1, iter2] = tee(iterable, 2);\n * console.log([...iter1]);\n * // Output: [1, 2, 3, 4, 5]\n *\n * console.log([...iter2]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function tee<const ElementType>(iterable: IterableResolvable<ElementType>, count: number): IterableIterator<ElementType>[] {\n\tcount = assertNotNegative(toIntegerOrThrow(count), count);\n\tif (count === 0) return [];\n\n\tconst entries = [] as ElementType[];\n\tconst indexes = toArray(repeat(0, count));\n\tconst resolvedIterable = from(iterable);\n\n\tconst iterables = [] as IterableIterator<ElementType>[];\n\tfor (let i = 0; i < count; i++) {\n\t\tconst iterable = makeIterableIterator<ElementType>(() => {\n\t\t\tif (indexes[i] >= entries.length) {\n\t\t\t\tconst result = resolvedIterable.next();\n\t\t\t\tif (result.done) {\n\t\t\t\t\treturn { done: true, value: undefined };\n\t\t\t\t}\n\n\t\t\t\tentries.push(result.value);\n\t\t\t}\n\n\t\t\treturn { done: false, value: entries[indexes[i]++] };\n\t\t});\n\n\t\titerables.push(iterable);\n\t}\n\n\treturn iterables;\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an iterable with the elements that are in either input iterable.\n *\n * @param iterables The iterators to combine.\n * @returns An iterator that yields the union of the provided iterators.\n *\n * @example\n * ```typescript\n * import { union } from '@sapphire/iterator-utilities';\n *\n * const iterable1 = [1, 2, 3];\n * const iterable2 = [3, 4, 5];\n * console.log([...union(iterable1, iterable2)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function* union<const ElementType>(...iterables: IterableResolvable<ElementType>[]): IterableIterator<ElementType> {\n\tconst seen = new Set<ElementType>();\n\tfor (const iterator of iterables) {\n\t\tfor (const value of toIterableIterator(iterator)) {\n\t\t\tif (!seen.has(value)) {\n\t\t\t\tseen.add(value);\n\t\t\t\tyield value;\n\t\t\t}\n\t\t}\n\t}\n}\n","import type { IterableResolvable } from './from';\nimport { union } from './union';\n\n/**\n * Creates an iterable with the unique elements of the input iterable. Under the hood, it calls {@linkcode union} with the iterable itself.\n *\n * @param iterable An iterator to remove duplicates from.\n * @returns An iterator that yields the values of the provided iterator with duplicates removed.\n *\n * @example\n * ```typescript\n * import { unique } from '@sapphire/iterator-utilities';\n *\n * const iterable = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5];\n * console.log([...unique(iterable)]);\n * // Output: [1, 2, 3, 4, 5]\n * ```\n */\nexport function unique<const ElementType>(iterable: IterableResolvable<ElementType>): IterableIterator<ElementType> {\n\t// The union of a single iterator is the iterator itself, with duplicates removed.\n\treturn union(iterable);\n}\n","import type { IterableResolvable } from './from';\nimport { toIterableIterator } from './toIterableIterator';\n\n/**\n * Creates an array for each element of the input iterable, transposing the input iterable. The opposite of {@linkcode zip}.\n *\n * @param iterable An iterable to unzip.\n * @returns An array of iterables that yield the values of the original iterable.\n *\n * @example\n * ```typescript\n * import { unzip } from '@sapphire/iterator-utilities';\n *\n * const iterable = [[1, 'a'], [2, 'b'], [3, 'c']];\n * const [numbers, letters] = unzip(iterable);\n *\n * console.log(numbers);\n * // Output: [1, 2, 3]\n *\n * console.log(letters);\n * // Output: ['a', 'b', 'c']\n * ```\n *\n * @remarks\n *\n * This function consumes the entire iterable.\n */\nexport function unzip<const ElementType extends readonly any[]>(iterable: IterableResolvable<ElementType>): UnzipIterable<ElementType> {\n\tconst resolvedIterable = toIterableIterator(iterable);\n\tconst firstResult = resolvedIterable.next();\n\tif (firstResult.done) {\n\t\tthrow new Error('Cannot unzip an empty iterable');\n\t}\n\n\tif (!Array.isArray(firstResult.value)) {\n\t\tthrow new Error('Cannot unzip an iterable that does not yield an array');\n\t}\n\n\tconst size = firstResult.value.length;\n\tconst results = [] as ElementType[][];\n\tfor (let i = 0; i < size; i++) results.push([firstResult.value[i]]);\n\tfor (const entries of resolvedIterable) {\n\t\tif (!Array.isArray(entries)) {\n\t\t\tthrow new Error('Cannot unzip an iterable that does not yield an array');\n\t\t}\n\n\t\tif (entries.length !== size) {\n\t\t\tthrow new Error('Cannot unzip an iterable that yields arrays of different sizes');\n\t\t}\n\n\t\tfor (let i = 0; i < size; i++) {\n\t\t\tresults[i].push(entries[i]);\n\t\t}\n\t}\n\n\treturn results as UnzipIterable<ElementType>;\n}\n\nexport type UnzipIterable<ElementType extends readonly any[]> = {\n\t-readonly [P in keyof ElementType]: ElementType[P][];\n};\n","import { from, type IterableResolvable } from './from';\n\n/**\n * Creates an iterable with the elements of the input iterables zipped together. The opposite of {@linkcode unzip}.\n *\n * @param iterables The iterables to zip together.\n * @returns A new iterable that yields the next value of each iterable in the list.\n *\n * @example\n * ```typescript\n * import { zip } from '@sapphire/iterator-utilities';\n *\n * const iterable1 = [1, 2, 3];\n * const iterable2 = ['a', 'b', 'c'];\n * const iterable3 = [true, false, true];\n *\n * console.log(zip(iterable1, iterable2, iterable3));\n * // Output: [\n * // \t[1, 'a', true],\n * // \t[2, 'b', false],\n * // \t[3, 'c', true]\n * // ]\n * ```\n */\nexport function* zip<const Iterables extends readonly IterableResolvable<any>[]>(...iterables: Iterables): ZipIterators<Iterables> {\n\tconst resolvedIterables = iterables.map((iterable) => from(iterable));\n\twhile (true) {\n\t\tconst results = [] as any[];\n\t\tfor (const resolvedIterable of resolvedIterables) {\n\t\t\tconst result = resolvedIterable.next();\n\t\t\tif (result.done) return;\n\n\t\t\tresults.push(result.value);\n\t\t}\n\n\t\tyield results as any;\n\t}\n}\n\nexport type ZipIterators<Iterators extends readonly IterableResolvable<any>[]> = IterableIterator<{\n\t-readonly [P in keyof Iterators]: Iterators[P] extends IterableResolvable<infer T> ? T : never;\n}>;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/iterator-utilities",
|
|
3
|
-
"version": "1.0.3-next.
|
|
3
|
+
"version": "1.0.3-next.ef2a0072",
|
|
4
4
|
"description": "An iterator utility library for JavaScript.",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"access": "public"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@favware/cliff-jumper": "^4.0.
|
|
57
|
-
"@vitest/coverage-v8": "^
|
|
58
|
-
"npm-run-all2": "^6.2.
|
|
59
|
-
"tsup": "^8.1
|
|
60
|
-
"tsx": "^4.
|
|
56
|
+
"@favware/cliff-jumper": "^4.0.3",
|
|
57
|
+
"@vitest/coverage-v8": "^2.0.3",
|
|
58
|
+
"npm-run-all2": "^6.2.2",
|
|
59
|
+
"tsup": "^8.2.1",
|
|
60
|
+
"tsx": "^4.16.2",
|
|
61
61
|
"typedoc": "^0.25.13",
|
|
62
62
|
"typedoc-json-parser": "^10.0.0",
|
|
63
63
|
"typescript": "~5.4.5",
|
|
64
|
-
"vitest": "^
|
|
64
|
+
"vitest": "^2.0.3"
|
|
65
65
|
},
|
|
66
66
|
"exports": {
|
|
67
67
|
".": {
|