Function forEach

  • For each function for iterables and asynchronous iterables.


    const logEach = forEach(console.log);

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

    Type Parameters

    • Item


    • 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>


        • iterable: Iterable

        Returns ReducerOutput<Iterable, void>