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 = any

    Parameters

    • array: T[]

      The sorted array to inspect.

    • value: T

      The value to evaluate.

    • iteratee: ArrayIteratee<T, number>

      The iteratee invoked per element.

    Returns number

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

    Since

    5.11.0

    Example

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

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