Sha256: bf039101776c42209d49dc4d6aa71766f6379b649570cbe1820a8665bbd2697f

Contents?: true

Size: 770 Bytes

Versions: 273

Compression:

Stored size: 770 Bytes

Contents

var baseSortedIndex = require('./_baseSortedIndex'),
    eq = require('./eq');

/**
 * This method is like `_.lastIndexOf` except that it performs a binary
 * search on a sorted `array`.
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Array
 * @param {Array} array The array to inspect.
 * @param {*} value The value to search for.
 * @returns {number} Returns the index of the matched value, else `-1`.
 * @example
 *
 * _.sortedLastIndexOf([4, 5, 5, 5, 6], 5);
 * // => 3
 */
function sortedLastIndexOf(array, value) {
  var length = array == null ? 0 : array.length;
  if (length) {
    var index = baseSortedIndex(array, value, true) - 1;
    if (eq(array[index], value)) {
      return index;
    }
  }
  return -1;
}

module.exports = sortedLastIndexOf;

Version data entries

273 entries across 271 versions & 29 rubygems

Version Path
immosquare-cleaner-0.1.60 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.59 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.58 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.57 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.56 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.55 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.54 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.53 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.52 node_modules/lodash/sortedLastIndexOf.js
trusty-cms-6.3.1 node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.51 node_modules/lodash/sortedLastIndexOf.js
boring_generators-0.15.0 tmp/templates/app_template/node_modules/lodash/sortedLastIndexOf.js
clapton-0.0.26 lib/clapton/javascripts/node_modules/lodash/sortedLastIndexOf.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/lodash/sortedLastIndexOf.js
immosquare-cleaner-0.1.50 node_modules/lodash/sortedLastIndexOf.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/lodash/sortedLastIndexOf.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/lodash/sortedLastIndexOf.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/lodash/sortedLastIndexOf.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/lodash/sortedLastIndexOf.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/lodash/sortedLastIndexOf.js