Sha256: c7c6144e6c78a229528d4573d9d2ba845e4cd9ad8fa68fd51fe32bbc7dea7286

Contents?: true

Size: 1.15 KB

Versions: 14

Compression:

Stored size: 1.15 KB

Contents

var baseCallback = require('../internal/baseCallback'),
    binaryIndex = require('../internal/binaryIndex'),
    binaryIndexBy = require('../internal/binaryIndexBy');

/**
 * 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.
 *
 * @static
 * @memberOf _
 * @category Array
 * @param {Array} array The sorted array to inspect.
 * @param {*} value The value to evaluate.
 * @param {Function|Object|string} [iteratee=_.identity] The function invoked
 *  per iteration. If a property name or object is provided it is used to
 *  create a "_.property" or "_.matches" style callback respectively.
 * @param {*} [thisArg] The `this` binding of `iteratee`.
 * @returns {number} Returns the index at which `value` should be inserted
 *  into `array`.
 * @example
 *
 * _.sortedLastIndex([4, 4, 5, 5, 6, 6], 5);
 * // => 4
 */
function sortedLastIndex(array, value, iteratee, thisArg) {
  return iteratee == null
    ? binaryIndex(array, value, true)
    : binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), true);
}

module.exports = sortedLastIndex;

Version data entries

14 entries across 7 versions & 1 rubygems

Version Path
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/update-notifier/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/array/sortedLastIndex.js