@univerjs/core v0.5.0-beta.1 • Docs
Function: searchArray()
function searchArray(
arr,
target,
firstMatch): number
Find value in the data that is just greater than the target; if there are equal values greater than the target, select the last one. If firstMatch is true, then return the index of the first number greater than the target. see #univer/pull/3903
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
arr | number [] | undefined | ascending array |
target | number | undefined | value wants to find |
firstMatch | boolean | false | if true, return the first match when value > target in the array, otherwise return the last value > target. if not match, |
Returns
number
index
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/array-search.ts:143