Function sortedIndexBy

  • This method is like sortedIndex except that it accepts iteratee which is invoked for value and each element of array to compute their sort ranking. The iteratee is invoked with one argument: (value).

    Type Parameters

    • T

    Parameters

    • array: T[]

      The sorted array to inspect.

    • value: any

      The value to evaluate.

    • iteratee: ((value: T) => any)

      The iteratee invoked per element.

        • (value): any
        • Parameters

          • value: T

          Returns any

    Returns number

    Returns the index at which value should be inserted into array.

    4.0.0

    const objects = [{ 'n': 4 }, { 'n': 5 }]

    sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n)
    // => 0