@mirei/ts-collections
    Preparing search index...

    Function selectMany

    • Projects each element and index into an iterable and flattens the results into a single sequence.

      Type Parameters

      • TElement

        Type of elements within the source iterable.

      • TResult

        Element type produced by the flattened iterables.

      Parameters

      Returns IEnumerable<TResult>

      A deferred sequence containing the concatenated contents of the iterables produced by selector.

      Each inner iterable is fully enumerated in order before the next source element is processed, preserving the relative ordering of results.

      const lists = [[1, 2], [3, 4], [5]];
      const flattened = selectMany(lists, x => x).toArray();
      console.log(flattened); // [1, 2, 3, 4, 5]