2.2.1 • Published 2 years ago

just-permutations v2.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

just-permutations

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-permutations
yarn add just-permutations

Returns all permutations of the length N of the elements of the given Array

import permutations from 'just-array-permutations;

permutations([1, 2, 3]); // [[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]]
permutations([]); // []
permutations(); // throws