Skip to content

Documentation / @eventkit/base / count

Function: count()

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

Counts the number of items emitted by the source observable, and emits that number when the source observable completes.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
predicate?(value, index) => booleanA function that is used to analyze the value and the index and determine whether or not to increment the count. Return true to increment the count, and return false to keep the count the same. If the predicate is not provided, every value will be counted.

Returns

SingletonOperatorFunction<T, number>

Released under the MIT License.