Function get

  • Negative indices count backwards from the end of the array.

    Remarks

    Returns undefined if index is fractional or NaN.

    Example

    import * as A from "flurp/array";

    const indexTwo = A.get(2);
    indexTwo([3, 4, 5, 6, 7]); // 5

    const secondToLast = A.get(-2);
    secondToLast([3, 4, 5, 6, 7]); // 6

    Type Parameters

    • T

    Parameters

    • index: number

    Returns ((arr: readonly T[]) => undefined | null | T)

      • (arr: readonly T[]): undefined | null | T
      • Parameters

        • arr: readonly T[]

        Returns undefined | null | T