Returns a Stream that yields the permutations of the specified iterable.
Type of items in the Stream.
Iterable to create the Stream from.
Optional
Number of items to yield.
Stream that yields the permutations of the specified iterable.
const result = permutations([1, 2, 3], 2);console.log([...result]); // [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]] Copy
const result = permutations([1, 2, 3], 2);console.log([...result]); // [[1, 2], [1, 3], [2, 1], [2, 3], [3, 1], [3, 2]]
Returns a Stream that yields the permutations of the specified iterable.