Function greatestIndex

  • Returns the index of the greatest element of the specified iterable according to the specified comparator or accessor. If the given iterable contains no comparable elements (i.e., the comparator returns NaN when comparing each element to itself), returns -1. If comparator is not specified, it defaults to ascending.

    Parameters

    • iterable: Iterable<unknown>

    Returns number | undefined

  • Returns the index of the greatest element of the specified iterable according to the specified comparator or accessor. If the given iterable contains no comparable elements (i.e., the comparator returns NaN when comparing each element to itself), returns -1. If comparator is not specified, it defaults to ascending.

    Type Parameters

    • T

    Parameters

    • iterable: Iterable<T>
    • comparator: ((a, b) => number)
        • (a, b): number
        • Parameters

          • a: T
          • b: T

          Returns number

    Returns number | undefined

  • Returns the index of the greatest element of the specified iterable according to the specified comparator or accessor. If the given iterable contains no comparable elements (i.e., the comparator returns NaN when comparing each element to itself), returns -1. If comparator is not specified, it defaults to ascending.

    Type Parameters

    • T

    Parameters

    • iterable: Iterable<T>
    • accessor: ((a) => unknown)
        • (a): unknown
        • Parameters

          • a: T

          Returns unknown

    Returns number | undefined