ts-iterable-functions
    Preparing search index...

    Function _indexed

    • Pairs each element from the source iterable with its zero-based index.

      Type Parameters

      • T

        Element type produced by the source iterable.

      Parameters

      • src: Iterable<T>

        Source iterable to enumerate with index positions.

      Returns Iterable<Indexed<T>>

      A deferred iterable yielding [item, index] tuples for every element.

      const pairs = [..._indexed(["a", "b", "c"])];
      console.log(pairs); // [["a", 0], ["b", 1], ["c", 2]]

      or using the curried version:

      const pairs = [
      ...pipeInto(
      ["a", "b", "c"],
      indexed()
      ),
      ];
      console.log(pairs); // [["a", 0], ["b", 1], ["c", 2]]