Function atSync

  • Retrieves the element at a given index from an input sync iterable.

    Returns

    A function that accepts an input sync iterable and returns the element at the specified index.

    Example

    const input = [1, 2, 3];
    const elementAtIndex2 = atSync<number>(2)(input);
    console.log(elementAtIndex2); // Logs 3

    Remarks

    Available as at when imported from peter-piper/sync.

    Type Parameters

    • T

      The type of elements in the input sync iterable.

    Parameters

    • i: number

      The index of the element to retrieve.

    Returns ((input: Iterable<T>) => undefined | T)

      • (input: Iterable<T>): undefined | T
      • Parameters

        • input: Iterable<T>

        Returns undefined | T

Generated using TypeDoc