Prelude API
    Preparing search index...

    Function withIndex

    • Creates a generator that yields each value from the input iterable along with its index.

      Type Parameters

      • T

        The type of elements in the input iterable

      Parameters

      • values: Iterable<T>

        The input iterable of values

      Returns Generator<[T, number]>

      • A tuple containing the value and its index
      G.pipe(
      [10, 20, 30],
      G.withIndex,
      G.array
      ) // [[10, 0], [20, 1], [30, 2]]