4.17.11
3.10.1
2.4.2
1.3.1

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

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

Since

4.0.0

Arguments

argument
array
value
[iteratee=_.identity]
type
Array
*
Function
description
The sorted array to inspect.
The value to evaluate.
The iteratee invoked per element.

Returns

(array)

Example

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

_.sortedIndexBy(
  objects,
  { x: 4 },
  function (o) {
    return o.x;
  }
);
// => 0

// The `_.property` iteratee shorthand.
_.sortedIndexBy(objects, { x: 4 }, "x");
// => 0
var objects = [{ x: 4 }, { x: 5 }];

_.sortedIndexBy(objects, { x: 4 }, function (o) {
  return o.x;
});
// => 0

// The `_.property` iteratee shorthand.
_.sortedIndexBy(objects, { x: 4 }, "x");
// => 0