sortedLastIndexOf source npm

_.sortedLastIndexOf(array, value)

This method is like _.lastIndexOf except that it performs a binary search on a sorted array.

Arguments

  1. array (Array)

    The array to search.

  2. value (*)

    The value to search for.

Returns (number)

Returns the index of the matched value, else -1.

Example

_.sortedLastIndexOf([1, 1, 2, 2], 2);
// => 3