Documentation / @eventkit/base / find
Function: find()
Call Signature
ts
function find<T, S>(predicate): SingletonOperatorFunction<T, undefined | S>Emits the first value emitted by the source observable that satisfies a specified condition. If no such value is found, emits undefined when the source observable completes.
Type Parameters
| Type Parameter |
|---|
T |
S |
Parameters
| Parameter | Type | Description |
|---|---|---|
predicate | (value, index) => value is S | A function that evaluates each value emitted by the source observable. Returns true if the value satisfies the condition, false otherwise. |
Returns
SingletonOperatorFunction<T, undefined | S>
Call Signature
ts
function find<T>(predicate): SingletonOperatorFunction<T, undefined | T>Emits the first value emitted by the source observable that satisfies a specified condition. If no such value is found, emits undefined 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, undefined | T>
Call Signature
ts
function find<T>(predicate): SingletonOperatorFunction<T, TruthyTypesOf<T>>Emits the first value emitted by the source observable that satisfies a specified condition. If no such value is found, emits undefined 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, TruthyTypesOf<T>>