ts-iterable-functions
    Preparing search index...

    Function forEachConst

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

      Curried version of _forEach.

      Type Parameters

      • T

        Element type produced by the source iterable.

      Parameters

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

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

      Returns (src: Iterable) => 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"]