Skip to content

Documentation / @eventkit/base / findIndex

Function: findIndex() ​

Call Signature ​

ts
function findIndex<T>(predicate): SingletonOperatorFunction<T, T extends Falsy ? -1 : number>

Emits the index of the first value emitted by the source observable that satisfies a specified condition. If no such value is found, emits -1 when the source observable completes.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterTypeDescription
predicateBooleanConstructorA function that evaluates each value emitted by the source observable. Returns true if the value satisfies the condition, false otherwise.

Returns ​

SingletonOperatorFunction<T, T extends Falsy ? -1 : number>

Call Signature ​

ts
function findIndex<T>(predicate): SingletonOperatorFunction<T, number>

Emits the index of the first value emitted by the source observable that satisfies a specified condition. If no such value is found, emits -1 when the source observable completes.

Type Parameters ​

Type Parameter
T

Parameters ​

ParameterTypeDescription
predicate(value, index) => booleanA function that evaluates each value emitted by the source observable. Returns true if the value satisfies the condition, false otherwise.

Returns ​

SingletonOperatorFunction<T, number>

Released under the MIT License.