@metreeca/flow - v0.9.21
    Preparing search index...

    Function count

    • Creates a sink counting the items of the feed.

      The feed is drained without retaining any item, so counting stays within constant memory whatever its size, but never completes on an infinite source.

      Type Parameters

      • V

        The type of items in the feed

      Returns Sink<V, number>

      A sink resolving to the number of items the feed carried

      await pipe(
      (items(1, 2, 3, 4, 5))
      (count())
      ); // 5

      await pipe(
      (items<number>())
      (count())
      ); // 0