ts-iterable-functions
    Preparing search index...

    Function _forEach

    • Executes the provided action for each element in the source iterable.

      Type Parameters

      • T

        Element type produced by the source iterable.

      Parameters

      • src: Iterable<T>

        Source iterable enumerated to supply values to action.

      • action: (x: T, i: number) => void

        Callback invoked with the current value and index for its side effects.

      Returns void

      void after running the action against every item from the source.

      const log: Array<[number, number]> = [];
      _forEach([10, 20], (value, index) => {
      log.push([value, index]);
      });
      console.log(log); // [[10, 0], [20, 1]]

      or using the curried version:

      const log: string[] = [];
      pipeInto(
      ["a", "b"],
      forEach((value, index) => {
      log.push(`${index}:${value}`);
      })
      );
      console.log(log); // ["0:a", "1:b"]