@newdash/newdash
Version:
javascript/typescript utility library
30 lines (29 loc) • 979 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.sortedLastIndex = void 0;
const baseSortedIndex_1 = __importDefault(require("./.internal/baseSortedIndex"));
/**
* This method is like `sortedIndex` except that it returns the highest
* index at which `value` should be inserted into `array` in order to
* maintain its sort order.
*
* @since 5.11.0
* @category Array
* @param array The sorted array to inspect.
* @param value The value to evaluate.
* @returns Returns the index at which `value` should be inserted into `array`.
* @example
*
* ```js
* sortedLastIndex([4, 5, 5, 5, 6], 5)
* // => 4
* ```
*/
function sortedLastIndex(array, value) {
return (0, baseSortedIndex_1.default)(array, value, true);
}
exports.sortedLastIndex = sortedLastIndex;
exports.default = sortedLastIndex;