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
Parameter | Type | Description |
---|---|---|
predicate | BooleanConstructor | A 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
Parameter | Type | Description |
---|---|---|
predicate | (value , index ) => boolean | A function that evaluates each value emitted by the source observable. Returns true if the value satisfies the condition, false otherwise. |
Returns
SingletonOperatorFunction
<T
, number
>