@lou.codes/iterables
Version:
🔁 Iterable and AsyncIterable utils
15 lines (14 loc) • 457 B
TypeScript
/**
* Yields a tuple for each item in the iterable with the index of said item.
*
* @category Generators
* @example
* ```typescript
* zipIndex(["foo", "bar"]); // [[0, "foo"], [1, "bar"]]
* ```
* @param iterable Iterable to add indexes to.
* @yields Tuples with the index of each item.
*/
export declare const zipIndex: <ItemSecond>(
iterableSecond: Readonly<Iterable<ItemSecond>>,
) => Readonly<IterableIterator<readonly [number, ItemSecond]>>;