1
|
var baseSortedIndex = require('./_baseSortedIndex');
|
2
|
|
3
|
/**
|
4
|
* This method is like `_.sortedIndex` except that it returns the highest
|
5
|
* index at which `value` should be inserted into `array` in order to
|
6
|
* maintain its sort order.
|
7
|
*
|
8
|
* @static
|
9
|
* @memberOf _
|
10
|
* @since 3.0.0
|
11
|
* @category Array
|
12
|
* @param {Array} array The sorted array to inspect.
|
13
|
* @param {*} value The value to evaluate.
|
14
|
* @returns {number} Returns the index at which `value` should be inserted
|
15
|
* into `array`.
|
16
|
* @example
|
17
|
*
|
18
|
* _.sortedLastIndex([4, 5, 5, 5, 6], 5);
|
19
|
* // => 4
|
20
|
*/
|
21
|
function sortedLastIndex(array, value) {
|
22
|
return baseSortedIndex(array, value, true);
|
23
|
}
|
24
|
|
25
|
module.exports = sortedLastIndex;
|