You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

sortedLastIndex.js 679B

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