f3230e10f83116200d12eedf6ed24d1ca0354b67
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / sortedIndexBy.js
1 var baseIteratee = require('./_baseIteratee'),
2     baseSortedIndexBy = require('./_baseSortedIndexBy');
3
4 /**
5  * This method is like `_.sortedIndex` except that it accepts `iteratee`
6  * which is invoked for `value` and each element of `array` to compute their
7  * sort ranking. The iteratee is invoked with one argument: (value).
8  *
9  * @static
10  * @memberOf _
11  * @category Array
12  * @param {Array} array The sorted array to inspect.
13  * @param {*} value The value to evaluate.
14  * @param {Function|Object|string} [iteratee=_.identity] The iteratee invoked per element.
15  * @returns {number} Returns the index at which `value` should be inserted into `array`.
16  * @example
17  *
18  * var dict = { 'thirty': 30, 'forty': 40, 'fifty': 50 };
19  *
20  * _.sortedIndexBy(['thirty', 'fifty'], 'forty', _.propertyOf(dict));
21  * // => 1
22  *
23  * // The `_.property` iteratee shorthand.
24  * _.sortedIndexBy([{ 'x': 4 }, { 'x': 5 }], { 'x': 4 }, 'x');
25  * // => 0
26  */
27 function sortedIndexBy(array, value, iteratee) {
28   return baseSortedIndexBy(array, value, baseIteratee(iteratee));
29 }
30
31 module.exports = sortedIndexBy;