ts-iterable-functions
    Preparing search index...

    Function flatMapConst

    • Maps each element to an iterable and yields every item from the flattened results in source order.

      Curried version of _flatMap.

      Type Parameters

      • T

        Element type produced by the source iterable.

      • TOut

        Element type emitted by the projected iterables.

      Parameters

      • selector: IndexedSelector<T, Iterable<TOut, any, any>>

        Projection invoked with the current value and index to produce an iterable of results.

      Returns (src: Iterable) => Iterable

      A deferred iterable yielding items from each projected iterable sequentially.

      const values = [..._flatMap([1, 2], (n) => [n, n * 10])];
      console.log(values); // [1, 10, 2, 20]

      or using the curried version:

      const values = pipeInto(
      ["a", "b"],
      flatMap((value, index) => [`${value}${index}`, `${value.toUpperCase()}${index}`])
      );
      console.log([...values]); // ["a0", "A0", "b1", "B1"]