.sortedLastIndexBy(array, value, [iteratee=.identity])
This method is like _.sortedLastIndex
except that it accepts iteratee
which is invoked for value
and each element of array
to compute their sort ranking. The iteratee is invoked with one argument: (value).
Since
4.0.0
Arguments
array
(Array): The sorted array to inspect.value
(*): The value to evaluate.[iteratee=.identity]
(Function)_: The iteratee invoked per element.
Returns
(number): Returns the index at which value
should be inserted into array
.
Example
var objects = [{ 'x': 4 }, { 'x': 5 }];_.sortedLastIndexBy(objects, { 'x': 4 }, function(o) { return o.x; });// => 1// The `_.property` iteratee shorthand._.sortedLastIndexBy(objects, { 'x': 4 }, 'x');// => 1
当前内容版权归 lodash.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 lodash.com .