function permutations
permutations<T>(inputArray: Iterable<T>): T[][]Builds all possible orders of all elements in the given array Ignores equality of elements, meaning this will always return the same number of permutations for a given length of input.
Examples
Example 1
Example 1
import { permutations } from "@std/collections/permutations"; import { assertEquals } from "@std/assert/assert_equals"; const numbers = [ 1, 2 ]; const windows = permutations(numbers); assertEquals(windows, [ [ 1, 2 ], [ 2, 1 ], ]);
Type Parameters
TParameters
inputArray: Iterable<T>Return Type
T[][]