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

    Function take

    • Creates a task truncating the feed to a prefix.

      Items are emitted lazily, in source order, and the feed ends as soon as the quota is met rather than draining the source: this is the standard way to bound an otherwise infinite feed.

      Type Parameters

      • V

        The type of items in the feed

      Parameters

      • n: number

        The maximum number of leading items to emit; values less than 1 empty the feed

      Returns Task<V>

      A task yielding at most the first n items

      If n is not an integer

      await pipe(
      (items(1, 2, 3, 4, 5))
      (take(3))
      (toArray())
      ); // [1, 2, 3]