UNPKG

@lou.codes/iterables

Version:
15 lines (14 loc) 457 B
/** * 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]>>;