@szilanor/stream
    Preparing search index...

    Function combinations

    • Returns a Stream that yields the combinations of the specified iterable.

      Type Parameters

      • T

        Type of items in the Stream.

      Parameters

      • iterable: Iterable<T>

        Iterable to create the Stream from.

      • r: number

        Number of items to yield.

      Returns Stream<T[]>

      Stream that yields the combinations of the specified iterable.

      const result = combinations([1, 2, 3], 2);
      console.log([...result]); // [[1, 2], [1, 3], [2, 3]]