react / wstein / node_modules / jest-cli / node_modules / istanbul / node_modules / js-yaml / node_modules / argparse / node_modules / lodash / array / sortedIndex.js
80742 viewsvar createSortedIndex = require('../internal/createSortedIndex');12/**3* Uses a binary search to determine the lowest index at which `value` should4* be inserted into `array` in order to maintain its sort order. If an iteratee5* function is provided it is invoked for `value` and each element of `array`6* to compute their sort ranking. The iteratee is bound to `thisArg` and7* invoked with one argument; (value).8*9* If a property name is provided for `iteratee` the created `_.property`10* style callback returns the property value of the given element.11*12* If a value is also provided for `thisArg` the created `_.matchesProperty`13* style callback returns `true` for elements that have a matching property14* value, else `false`.15*16* If an object is provided for `iteratee` the created `_.matches` style17* callback returns `true` for elements that have the properties of the given18* object, else `false`.19*20* @static21* @memberOf _22* @category Array23* @param {Array} array The sorted array to inspect.24* @param {*} value The value to evaluate.25* @param {Function|Object|string} [iteratee=_.identity] The function invoked26* per iteration.27* @param {*} [thisArg] The `this` binding of `iteratee`.28* @returns {number} Returns the index at which `value` should be inserted29* into `array`.30* @example31*32* _.sortedIndex([30, 50], 40);33* // => 134*35* _.sortedIndex([4, 4, 5, 5], 5);36* // => 237*38* var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };39*40* // using an iteratee function41* _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {42* return this.data[word];43* }, dict);44* // => 145*46* // using the `_.property` callback shorthand47* _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');48* // => 149*/50var sortedIndex = createSortedIndex();5152module.exports = sortedIndex;535455