sortedLastIndex.js 786 B

12345678910111213141516171819202122232425
  1. var createSortedIndex = require('../internal/createSortedIndex');
  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. * @category Array
  10. * @param {Array} array The sorted array to inspect.
  11. * @param {*} value The value to evaluate.
  12. * @param {Function|Object|string} [iteratee=_.identity] The function invoked
  13. * per iteration.
  14. * @param {*} [thisArg] The `this` binding of `iteratee`.
  15. * @returns {number} Returns the index at which `value` should be inserted
  16. * into `array`.
  17. * @example
  18. *
  19. * _.sortedLastIndex([4, 4, 5, 5], 5);
  20. * // => 4
  21. */
  22. var sortedLastIndex = createSortedIndex(true);
  23. module.exports = sortedLastIndex;