Function elementAt

  • Gets the element at the specified index.

    Type Parameters

    • T

      Type of items in the source.

    Parameters

    • index: number

      Index of the element to get.

    Returns CollectorFunction<T, T | undefined>

    Collector that gets the element at the specified index.

    const result = elementAt<number>(1)([1, 2, 3]);
    console.log(result); // 2