Sortedindexby

_.sortedIndexBy()

_.sortedIndexBy(array, value, [iteratee=_.identity])

This method is like _.sortedIndex 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).

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

Deep

mid = (low + high) >>> 1;
二分查找 使用無符號右移運算符(>>>)將結果除以2並向下取整

無符號右移算符(>>>