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

    Function map

    • Creates a task converting each item into a new value.

      Items are emitted in source order.

      Note

      • Incremental: items are emitted as they are drawn, so the reported feed runs dry as the feed drawn from does.
      • Streaming: items are converted one at a time, none retained.
      • Stateless: every item is converted on its own, so the outcome is unaffected by how the feed is split across nested feeds or runs.

      Type Parameters

      • V

        The type of input items

      • R

        The type of output items

      Parameters

      • mapper: (item: NoInfer<V>) => Awaitable<R>

        The function converting each item

      Returns Task<V, R>

      A task yielding the values mapper converts the items into

      await pipe(
      (items([1, 2, 3]))
      (map(n => n*2))
      (toArray())
      ); // [2, 4, 6]