main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[d565449] | 1 | import baseIteratee from './_baseIteratee.js';
|
---|
| 2 | import baseSortedIndexBy from './_baseSortedIndexBy.js';
|
---|
| 3 |
|
---|
| 4 | /**
|
---|
| 5 | * This method is like `_.sortedLastIndex` 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 | * @since 4.0.0
|
---|
| 12 | * @category Array
|
---|
| 13 | * @param {Array} array The sorted array to inspect.
|
---|
| 14 | * @param {*} value The value to evaluate.
|
---|
| 15 | * @param {Function} [iteratee=_.identity] The iteratee invoked per element.
|
---|
| 16 | * @returns {number} Returns the index at which `value` should be inserted
|
---|
| 17 | * into `array`.
|
---|
| 18 | * @example
|
---|
| 19 | *
|
---|
| 20 | * var objects = [{ 'x': 4 }, { 'x': 5 }];
|
---|
| 21 | *
|
---|
| 22 | * _.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });
|
---|
| 23 | * // => 1
|
---|
| 24 | *
|
---|
| 25 | * // The `_.property` iteratee shorthand.
|
---|
| 26 | * _.sortedLastIndexBy(objects, { 'x': 4 }, 'x');
|
---|
| 27 | * // => 1
|
---|
| 28 | */
|
---|
| 29 | function sortedLastIndexBy(array, value, iteratee) {
|
---|
| 30 | return baseSortedIndexBy(array, value, baseIteratee(iteratee, 2), true);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | export default sortedLastIndexBy;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.