@univerjs/core v0.5.0-beta.1 • Docs
Function: searchInOrderedArray()
function searchInOrderedArray(arr, target): number
Return the index of the first value in an ascending array that is greater than the target value. If there is no value greater than the target, return -1.
Alternatively, you can consider inserting a number to ensure the array remains sorted, and return the position for insertion. If the target is the same as the maximum value, return arr.length -1
Parameters
Parameter | Type |
---|---|
arr | number [] |
target | number |
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/array-search.ts:24