@univerjscorefunctionsBinsearchfirstgreaterthantarget

@univerjs/core v0.5.0-beta.1Docs


Function: binSearchFirstGreaterThanTarget()

function binSearchFirstGreaterThanTarget(arr, target): number

Return the index of the last index in an ascending array which value is just greater than the target. If there is no value greater than the target, return arr.length - 1.

Alternatively, you can consider inserting a number to ensure the array remains sorted, and return the position for insertion.

Parameters

ParameterType
arrnumber[]
targetnumber

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/array-search.ts:105