Skip to content

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 ​

ParameterTypeDescription
predicate(value, index) => value is SA 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 ​

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, 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 ​

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, TruthyTypesOf<T>>

Released under the MIT License.