apiref
bsearch@1.0.0

smallestInt()  Function

Returns the smallest integer value in range [min, max] that is accepted by the predicate.

Signature

export declare function smallestInt(min: number, max: number, predicate: (value: number) => boolean): number | undefined;

Parameters

ParameterTypeDescription
minnumber

The minimum value to search for.

maxnumber

The maximum value to search for.

predicate(value: number) => boolean

A predicate. There should exist some value X such that predicate(x) returns true for all x >= X and returns false otherwise.

(Returns)number | undefined

The smallest integer value whose predicate returns true, or undefined if no such value exists.