Skip to main content

sortedLastIndexBy

_.sortedLastIndexBy(iteratee, value, array) # Ⓢ [Ⓣ][1] Ⓝ

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).

Since​

4.0.0

Arguments​

  1. iteratee (Function): The iteratee invoked per element.
  2. value (*): The value to evaluate.
  3. array (Array): The sorted array to inspect.

Returns​

(number): Returns the index at which value should be inserted



into array.

Example​

var objects = [{ 'x': 4 }, { 'x': 5 }];

_.sortedLastIndexBy(function(o) { return o.x; }, { 'x': 4 }, objects);
// => 1

// The `_.property` iteratee shorthand.
_.sortedLastIndexBy('x', { 'x': 4 }, objects);
// => 1