Function count

  • Counts the number of elements in the source.

    Type Parameters

    • T

      Type of items in the source.

    Parameters

    • predicateFunction: PredicateFunction<T> = ...

      Predicate function to determine if an element should be counted.

    Returns CollectorFunction<T, number>

    Collector that counts the number of elements in the source.

    const result = count<number>()([1, 2, 3]);
    console.log(result); // 3