sortedLastIndexBy source npm

_.sortedLastIndexBy(array, value, [iteratee=_.identity])

This method is like _.sortedLastIndex 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).

Arguments

  1. array (Array)

    The sorted array to inspect.

  2. value (*)

    The value to evaluate.

  3. [iteratee=_.identity] (Function|Object|string)

    The function invoked per element.

Returns (number)

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

Example

// using the `_.property` callback shorthand
_.sortedLastIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
// => 1