Function forEach

  • For each function for iterables and asynchronous iterables.

    Example

    const logEach = forEach(console.log);

    logEach([1, 2, 3]); // Logs 1, 2 and 3 separately

    Type Parameters

    • Item

    Parameters

    • callback: Unary<Item, void>

      Function to be called for every item of the iterable.

    Returns (<Iterable>(iterable) => ReducerOutput<Iterable, void>)

    Curried function that expects an iterable to loop over and has callback set in context.

      • <Iterable>(iterable): ReducerOutput<Iterable, void>
      • Type Parameters

        • Iterable extends IsomorphicIterable<Item>

        Parameters

        • iterable: Iterable

        Returns ReducerOutput<Iterable, void>